mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
ipc: allow boot time extension of IPCMNI from 32k to 16M
The maximum number of unique System V IPC identifiers was limited to 32k. That limit should be big enough for most use cases. However, there are some users out there requesting for more, especially those that are migrating from Solaris which uses 24 bits for unique identifiers. To satisfy the need of those users, a new boot time kernel option "ipcmni_extend" is added to extend the IPCMNI value to 16M. This is a 512X increase which should be big enough for users out there that need a large number of unique IPC identifier. The use of this new option will change the pattern of the IPC identifiers returned by functions like shmget(2). An application that depends on such pattern may not work properly. So it should only be used if the users really need more than 32k of unique IPC numbers. This new option does have the side effect of reducing the maximum number of unique sequence numbers from 64k down to 128. So it is a trade-off. The computation of a new IPC id is not done in the performance critical path. So a little bit of additional overhead shouldn't have any real performance impact. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Waiman Long <[email protected]> Acked-by: Manfred Spraul <[email protected]> Cc: Al Viro <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: "Eric W . Biederman" <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Kees Cook <[email protected]> Cc: "Luis R. Rodriguez" <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Takashi Iwai <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
a5091fda4e
commit
5ac893b8cb
4 changed files with 54 additions and 15 deletions
10
ipc/util.c
10
ipc/util.c
|
|
@ -109,7 +109,7 @@ static const struct rhashtable_params ipc_kht_params = {
|
|||
* @ids: ipc identifier set
|
||||
*
|
||||
* Set up the sequence range to use for the ipc identifier range (limited
|
||||
* below IPCMNI) then initialise the keys hashtable and ids idr.
|
||||
* below ipc_mni) then initialise the keys hashtable and ids idr.
|
||||
*/
|
||||
void ipc_init_ids(struct ipc_ids *ids)
|
||||
{
|
||||
|
|
@ -225,7 +225,7 @@ static inline int ipc_idr_alloc(struct ipc_ids *ids, struct kern_ipc_perm *new)
|
|||
0, GFP_NOWAIT);
|
||||
}
|
||||
if (idx >= 0)
|
||||
new->id = SEQ_MULTIPLIER * new->seq + idx;
|
||||
new->id = (new->seq << IPCMNI_SEQ_SHIFT) + idx;
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
|
@ -253,8 +253,8 @@ int ipc_addid(struct ipc_ids *ids, struct kern_ipc_perm *new, int limit)
|
|||
/* 1) Initialize the refcount so that ipc_rcu_putref works */
|
||||
refcount_set(&new->refcount, 1);
|
||||
|
||||
if (limit > IPCMNI)
|
||||
limit = IPCMNI;
|
||||
if (limit > ipc_mni)
|
||||
limit = ipc_mni;
|
||||
|
||||
if (ids->in_use >= limit)
|
||||
return -ENOSPC;
|
||||
|
|
@ -737,7 +737,7 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
|
|||
if (total >= ids->in_use)
|
||||
return NULL;
|
||||
|
||||
for (; pos < IPCMNI; pos++) {
|
||||
for (; pos < ipc_mni; pos++) {
|
||||
ipc = idr_find(&ids->ipcs_idr, pos);
|
||||
if (ipc != NULL) {
|
||||
*new_pos = pos + 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue