dynamically tuning msgtql
RFC PATCH 1/1 dynamically tuning msgtql
Hi,
Please find below the patch (RFC) that makes msgtql dynamically tunable through /proc interface.
1) IPC_NOWAIT flag not handled.
Handling this will cause overheads (additional queue, wake-ups etc). Please comment.
Or Handling IPC_NOWAIT may require:
a) An additional global queue for processes when message to be queued is > msgtql && IPC_NOWAIT flag is not set. Please comment.
Thanks,
Dhruv
include/linux/msg.h +4 -4
@@ -49,13 +49,13 @@unsigned short msgseg; }; -#define MSGMNI 16/* <= IPCMNI */ /* max # of msg queue identifiers */ -#define MSGMAX 8192/* <= INT_MAX */ /* max size of message (bytes) */ -#define MSGMNB 16384/* <= INT_MAX */ /* default max size of a message queue */ +#define MSGMNI 16/* <= IPCMNI */ /* max # of msg queue identifiers */ +#define MSGMAX 8192/* <= INT_MAX */ /* max size of message (bytes) */ +#define MSGMNB 16384/* <= INT_MAX */ /* default max size of a message queue */ +#define MSGTQL 0x7fffffff/* <= INT_MAX */ /* number of system message */ /* unused */ #define MSGPOOL (MSGMNI*MSGMNB/1024)/* size in kilobytes of message pool */ -#define MSGTQL MSGMNB/* number of system message headers */ #define MSGMAP MSGMNB/* number of entries in message map */ #define MSGSSZ 16/* message segment size */ #define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ)/* max no. of segments */
include/linux/sysctl.h +1 -0
@@ -130,6 +130,7 @@KERN_PIDMAX =55 ,/* int: PID # limit */ KERN_CORE_PATTERN =56 ,/* string: pattern for core-file names */ KERN_PANIC_ON_OOPS =57 ,/* int: whether we will panic on an oops */ + KERN_MSGTQL=57, /* int: Maximum number of messages system wide */ };
ipc/msg.c +51 -34
111 lines not on this page · raw message
kernel/sysctl.c +6 -3
@@ -61,6 +61,9 @@/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ static int maxolduid =65535 ;static int minolduid; +static int zero =0 ; +static int one =1 ; +static int one_hundred =100 ;#ifdef CONFIG_KMOD extern char modprobe_path[];
@@ -78,6 +81,7 @@extern int msg_ctlmax;extern int msg_ctlmnb;extern int msg_ctlmni; +extern int msg_ctltql;extern int sem_ctls[];#endif
@@ -235,6 +239,8 @@ 0644, NULL, &proc_dointvec}, {KERN_MSGMNB, "msgmnb", &msg_ctlmnb, sizeof (int), 0644, NULL, &proc_dointvec}, + {KERN_MSGTQL, "msgtql", &msg_ctltql, sizeof (int), + 0644, NULL, &proc_dointvec_minmax, NULL, NULL, &zero, NULL}, {KERN_SEM, "sem", &sem_ctls, 4*sizeof (int), 0644, NULL, &proc_dointvec}, #endif
@@ -270,9 +276,6 @@/* Constants for minimum and maximum testing in vm_table. We use these as one-element integer vectors. */ -static int zero =0 ; -static int one =1 ; -static int one_hundred =100 ;static ctl_table vm_table[] = {