From: "Serge E. Hallyn" <serge@hallyn.com>
To: Doug Ledford <dledford@redhat.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
kosaki.motohiro@gmail.com
Subject: Re: [Patch 1/8] ipc/mqueue: cleanup definition names and locations
Date: Wed, 18 Apr 2012 03:14:52 +0000 [thread overview]
Message-ID: <20120418031452.GA18830@mail.hallyn.com> (raw)
In-Reply-To: <bbf228b7d5f94bd8750083a62f05b6aa51675558.1334676645.git.dledford@redhat.com>
Quoting Doug Ledford (dledford@redhat.com):
> The various defines for minimums and maximums of the sysctl controllable
> mqueue values are scattered amongst different files and named
> inconsistently. Move them all into ipc_namespace.h and make them have
> consistent names. Additionally, make the number of queues per namespace
> also have a minimum and maximum and use the same sysctl function as the
> other two settable variables.
>
> Signed-off-by: Doug Ledford <dledford@redhat.com>
I can't speak as to whether anyone would have a problem as a result of
the newly introduced min/max for # msg_queues, but other than that
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> ---
> include/linux/ipc_namespace.h | 5 +++++
> ipc/mq_sysctl.c | 31 ++++++++-----------------------
> 2 files changed, 13 insertions(+), 23 deletions(-)
>
> diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
> index 8a297a5..1372b56 100644
> --- a/include/linux/ipc_namespace.h
> +++ b/include/linux/ipc_namespace.h
> @@ -91,10 +91,15 @@ static inline void shm_destroy_orphaned(struct ipc_namespace *ns) {}
> #ifdef CONFIG_POSIX_MQUEUE
> extern int mq_init_ns(struct ipc_namespace *ns);
> /* default values */
> +#define MIN_QUEUESMAX 1
> #define DFLT_QUEUESMAX 256 /* max number of message queues */
> +#define HARD_QUEUESMAX 1024
> +#define MIN_MSGMAX 1
> #define DFLT_MSGMAX 10 /* max number of messages in each queue */
> #define HARD_MSGMAX (32768*sizeof(void *)/4)
> +#define MIN_MSGSIZEMAX 128
> #define DFLT_MSGSIZEMAX 8192 /* max message size */
> +#define HARD_MSGSIZEMAX (8192*128)
> #else
> static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
> #endif
> diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c
> index 0c09366..e22336a 100644
> --- a/ipc/mq_sysctl.c
> +++ b/ipc/mq_sysctl.c
> @@ -13,15 +13,6 @@
> #include <linux/ipc_namespace.h>
> #include <linux/sysctl.h>
>
> -/*
> - * Define the ranges various user-specified maximum values can
> - * be set to.
> - */
> -#define MIN_MSGMAX 1 /* min value for msg_max */
> -#define MAX_MSGMAX HARD_MSGMAX /* max value for msg_max */
> -#define MIN_MSGSIZEMAX 128 /* min value for msgsize_max */
> -#define MAX_MSGSIZEMAX (8192*128) /* max value for msgsize_max */
> -
> #ifdef CONFIG_PROC_SYSCTL
> static void *get_mq(ctl_table *table)
> {
> @@ -31,16 +22,6 @@ static void *get_mq(ctl_table *table)
> return which;
> }
>
> -static int proc_mq_dointvec(ctl_table *table, int write,
> - void __user *buffer, size_t *lenp, loff_t *ppos)
> -{
> - struct ctl_table mq_table;
> - memcpy(&mq_table, table, sizeof(mq_table));
> - mq_table.data = get_mq(table);
> -
> - return proc_dointvec(&mq_table, write, buffer, lenp, ppos);
> -}
> -
> static int proc_mq_dointvec_minmax(ctl_table *table, int write,
> void __user *buffer, size_t *lenp, loff_t *ppos)
> {
> @@ -52,15 +33,17 @@ static int proc_mq_dointvec_minmax(ctl_table *table, int write,
> lenp, ppos);
> }
> #else
> -#define proc_mq_dointvec NULL
> #define proc_mq_dointvec_minmax NULL
> #endif
>
> +static int msg_queues_limit_min = MIN_QUEUESMAX;
> +static int msg_queues_limit_max = HARD_QUEUESMAX;
> +
> static int msg_max_limit_min = MIN_MSGMAX;
> -static int msg_max_limit_max = MAX_MSGMAX;
> +static int msg_max_limit_max = HARD_MSGMAX;
>
> static int msg_maxsize_limit_min = MIN_MSGSIZEMAX;
> -static int msg_maxsize_limit_max = MAX_MSGSIZEMAX;
> +static int msg_maxsize_limit_max = HARD_MSGSIZEMAX;
>
> static ctl_table mq_sysctls[] = {
> {
> @@ -68,7 +51,9 @@ static ctl_table mq_sysctls[] = {
> .data = &init_ipc_ns.mq_queues_max,
> .maxlen = sizeof(int),
> .mode = 0644,
> - .proc_handler = proc_mq_dointvec,
> + .proc_handler = proc_mq_dointvec_minmax,
> + .extra1 = &msg_queues_limit_min,
> + .extra2 = &msg_queues_limit_max,
> },
> {
> .procname = "msg_max",
> --
> 1.7.7.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2012-04-18 3:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-17 15:46 [Patch 0/8] Fix POSIX mqueue open issue Doug Ledford
2012-04-17 15:46 ` [Patch 1/8] ipc/mqueue: cleanup definition names and locations Doug Ledford
2012-04-17 17:03 ` KOSAKI Motohiro
2012-04-18 3:14 ` Serge E. Hallyn [this message]
2012-04-17 15:46 ` [Patch 2/8] ipc/mqueue: switch back to using non-max values on create Doug Ledford
2012-04-17 22:17 ` Andrew Morton
2012-04-17 22:32 ` KOSAKI Motohiro
2012-04-17 23:00 ` Andrew Morton
2012-04-18 14:22 ` Doug Ledford
2012-04-17 15:46 ` [Patch 3/8] ipc/mqueue: enforce hard limits Doug Ledford
2012-04-17 15:46 ` [Patch 4/8] ipc/mqueue: update maximums for the mqueue subsystem Doug Ledford
2012-04-17 15:46 ` [Patch 5/8] mqueue: revert bump up DFLT_*MAX Doug Ledford
2012-04-18 3:22 ` Serge E. Hallyn
2012-04-18 3:37 ` KOSAKI Motohiro
2012-04-18 14:25 ` Doug Ledford
2012-04-18 15:33 ` Serge E. Hallyn
2012-04-17 15:46 ` [Patch 6/8] mqueue: don't use kmalloc with KMALLOC_MAX_SIZE Doug Ledford
2012-04-18 3:24 ` Serge E. Hallyn
2012-04-17 15:46 ` [Patch 7/8] mqueue: separate mqueue default value from maximum value v2 Doug Ledford
2012-04-18 3:30 ` Serge E. Hallyn
2012-04-17 15:46 ` [Patch 8/8] selftests: add mq_open_tests Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120418031452.GA18830@mail.hallyn.com \
--to=serge@hallyn.com \
--cc=akpm@linux-foundation.org \
--cc=dledford@redhat.com \
--cc=kosaki.motohiro@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox