D Davidlohr Bueso #
Message details and related content
Cc'ing mtk, Manfred and linux-api. See below. On Thu, 15 Mar 2018, Waiman Long wrote:
On 03/15/2018 03:00 PM, Eric W. Biederman wrote:quoted
Waiman Long [off-list ref] writes:quoted
On 03/14/2018 08:49 PM, Eric W. Biederman wrote:quoted
The define IPCMNI was originally the size of a statically sized array in the kernel and that has long since been removed. Therefore there is no fundamental reason for IPCMNI. The only remaining use IPCMNI serves is as a convoluted way to format the ipc id to userspace. It does not appear that anything except for the CHECKPOINT_RESTORE code even cares about this variety of assignment and the CHECKPOINT_RESTORE code only cares about this weirdness because it has to restore these peculiar ids. Therefore make the assignment of ipc ids match the description in Advanced Programming in the Unix Environment and assign the next id until INT_MAX is hit then loop around to the lower ids. This can be implemented trivially with the current code using idr_alloc_cyclic. To make it possible to keep checkpoint/restore working I have renamed the sysctls from xxx_next_id to xxx_nextid. That is enough change that a smart CRIU implementation can see that what is exported has changed, and act accordingly. New kernels will be able to restore the old id's. This code still needs some real world testing to verify my assumptions. And some work with the CRIU implementations to actually add the code that deals with the new for of id assignment. Updates: 03f595668017 ("ipc: add sysctl to specify desired next object id") Signed-off-by: "Eric W. Biederman" <redacted> --- Waiman please take a look at this and run it through some tests etc, I am pretty certain something like this patch is all you need to do to sort out ipc assignment. Not messing with sysctls needed. include/linux/ipc.h | 2 -- include/linux/ipc_namespace.h | 1 - ipc/ipc_sysctl.c | 6 ++--
I share these fears. Thanks, Davidlohr
My original thinking was to have an extended mode where the IPCMNI becomes 8M from 32k. That will reduce the sequence number from 16 bits to 8 bits. The extended mode is enabled by adding, for example, a boot option. So this will be an opt-in feature instead of as a default.quoted
Which comes down to the fundamental question what depends upon what. How do other operating systems like Solaris handle this?I don't know how Solaris handle this, but I know they support up to 2^24 shm segments.quoted
Does any nix flavor support more that 16bits worth of shm segments? The API has been deprecated for the last 20 years and we are still keeping it alive. Sigh. Still there is fundamentally only one thing the kernel can do if we wish to increase the number of shm segments. Please take my patch and test it out and see if you can find anything that cares about the change. Except for needing id reuse to be infrequent I can not imagine that there is anything that cares. It could very reasonably be argued that my when shmmni is < INT_MAX my patch implements a version of the existing algorithm. As we go through all of the possible ids before we reuse any of them. EricThanks for the patch, I am still thinking about what is the best way to handle this. Cheers, Longman