sysvipc: unteach ids->next_id for !CHECKPOINT_RESTORE
PATCH 83/94 sysvipc: unteach ids->next_id for !CHECKPOINT_RESTORE
From: Davidlohr Bueso <[email protected]>
Subject: sysvipc: unteach ids->next_id for !CHECKPOINT_RESTORE
Patch series "sysvipc: ipc-key management improvements".
Here are a few improvements I spotted while eyeballing Guillaume's rhashtable implementation for ipc keys. The first and fourth patches are the interesting ones, the middle two are trivial.
This patch (of 4):
The next_id object-allocation functionality was introduced in 03f595668017f ("ipc: add sysctl to specify desired next object id"). Given that these new entries are _only_ exported under the CONFIG_CHECKPOINT_RESTORE option, there is no point for the common case to even know about ->next_id. As such rewrite ipc_buildid() such that it can do away with the field as well as unnecessary branches when adding a new identifier. The end result also better differentiates both cases, so the code ends up being cleaner; albeit the small duplications regarding the default case.
---
include/linux/ipc_namespace.h | 2 + ipc/util.c | 60 ++++++++++++++++++++++++-------- ipc/util.h | 5 -- 3 files changed, 47 insertions(+), 20 deletions(-)
include/linux/ipc_namespace.h renamed from include/linux/ipc_namespace.h~sysvipc-unteach-ids-next_id-for-checkpoint_restore +2 -0
@@ -19,7 +19,9 @@ struct ipc_ids {bool tables_initialized;struct rw_semaphore rwsem;struct idr ipcs_idr; +#ifdef CONFIG_CHECKPOINT_RESTORE int next_id; +#endif struct rhashtable key_ht; };
ipc/util.c renamed from ipc/util.c~sysvipc-unteach-ids-next_id-for-checkpoint_restore +45 -15
97 lines not on this page · raw message
ipc/util.h renamed from ipc/util.h~sysvipc-unteach-ids-next_id-for-checkpoint_restore +0 -4
@@ -146,11 +146,6 @@ extern struct msg_msg *load_msg(const voextern struct msg_msg *copy_msg (struct msg_msg *src,struct msg_msg *dst);extern int store_msg (void __user *dest,struct msg_msg *msg,size_t len); -static inline int ipc_buildid (int id,int seq) -{ -return SEQ_MULTIPLIER * seq + id; -}