From: Chris Wright <chrisw@sous-sol.org>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, serue@us.ibm.com,
frankeh@watson.ibm.com, clg@fr.ibm.com,
Herbert Poetzl <herbert@13thfloor.at>,
Sam Vilain <sam@vilain.net>
Subject: Re: [RFC][PATCH 2/6] sysvmsg: containerize
Date: Mon, 6 Mar 2006 17:57:45 -0800 [thread overview]
Message-ID: <20060307015745.GG27645@sorel.sous-sol.org> (raw)
In-Reply-To: <20060306235250.35676515@localhost.localdomain>
* Dave Hansen (haveblue@us.ibm.com) wrote:
> --- work/include/linux/init_task.h~sysvmsg-container 2006-03-06 15:41:56.000000000 -0800
> +++ work-dave/include/linux/init_task.h 2006-03-06 15:41:56.000000000 -0800
> @@ -2,6 +2,7 @@
> #define _LINUX__INIT_TASK_H
>
> #include <linux/file.h>
> +#include <linux/ipc.h>
> #include <linux/rcupdate.h>
>
> #define INIT_FDTABLE \
missing INIT_IPC_CONTEXT type of macro?
> diff -puN include/linux/ipc.h~sysvmsg-container include/linux/ipc.h
> --- work/include/linux/ipc.h~sysvmsg-container 2006-03-06 15:41:56.000000000 -0800
> +++ work-dave/include/linux/ipc.h 2006-03-06 15:41:56.000000000 -0800
> @@ -68,6 +68,10 @@ struct kern_ipc_perm
> void *security;
> };
>
> +struct ipc_context;
> +extern struct ipc_context *ipc_context;
> +
> +extern struct ipc_msg_context *init_ipc_context(void);
> #endif /* __KERNEL__ */
>
> #endif /* _LINUX_IPC_H */
> diff -puN include/linux/sched.h~sysvmsg-container include/linux/sched.h
> --- work/include/linux/sched.h~sysvmsg-container 2006-03-06 15:41:56.000000000 -0800
> +++ work-dave/include/linux/sched.h 2006-03-06 15:41:56.000000000 -0800
> @@ -793,6 +793,7 @@ struct task_struct {
> int link_count, total_link_count;
> /* ipc stuff */
> struct sysv_sem sysvsem;
> + struct ipc_context *ipc_context;
how does this propagate on clone (presently it's just side-effect of
dup_task_struct starting from init_task, with no dynamic lifetime),
how is it meant to be changed?
> /* CPU-specific state of this task */
> struct thread_struct thread;
> /* filesystem information */
> diff -puN ipc/msg.c~sysvmsg-container ipc/msg.c
> --- work/ipc/msg.c~sysvmsg-container 2006-03-06 15:41:56.000000000 -0800
> +++ work-dave/ipc/msg.c 2006-03-06 15:41:56.000000000 -0800
> @@ -60,35 +60,30 @@ struct msg_sender {
> #define SEARCH_NOTEQUAL 3
> #define SEARCH_LESSEQUAL 4
>
> -static atomic_t msg_bytes = ATOMIC_INIT(0);
> -static atomic_t msg_hdrs = ATOMIC_INIT(0);
> +#define msg_lock(ctx, id) ((struct msg_queue*)ipc_lock(&ctx->ids,id))
> +#define msg_unlock(ctx, msq) ipc_unlock(&(msq)->q_perm)
> +#define msg_rmid(ctx, id) ((struct msg_queue*)ipc_rmid(&ctx->ids,id))
> +#define msg_checkid(ctx, msq, msgid) \
> + ipc_checkid(&ctx->ids,&msq->q_perm,msgid)
> +#define msg_buildid(ctx, id, seq) \
> + ipc_buildid(&ctx->ids, id, seq)
>
> -static struct ipc_ids msg_ids;
> -
> -#define msg_lock(id) ((struct msg_queue*)ipc_lock(&msg_ids,id))
> -#define msg_unlock(msq) ipc_unlock(&(msq)->q_perm)
> -#define msg_rmid(id) ((struct msg_queue*)ipc_rmid(&msg_ids,id))
> -#define msg_checkid(msq, msgid) \
> - ipc_checkid(&msg_ids,&msq->q_perm,msgid)
> -#define msg_buildid(id, seq) \
> - ipc_buildid(&msg_ids, id, seq)
> -
> -static void freeque (struct msg_queue *msq, int id);
> -static int newque (key_t key, int msgflg);
> +static void freeque (struct ipc_msg_context *, struct msg_queue *msq, int id);
> +static int newque (struct ipc_msg_context *context, key_t key, int id);
> #ifdef CONFIG_PROC_FS
> static int sysvipc_msg_proc_show(struct seq_file *s, void *it);
> #endif
>
> -void __init msg_init (void)
> +void __init msg_init (struct ipc_msg_context *context)
> {
> - ipc_init_ids(&msg_ids,msg_ctlmni);
> + ipc_init_ids(&context->ids,msg_ctlmni);
> ipc_init_proc_interface("sysvipc/msg",
> " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n",
> - &msg_ids,
> + &context->ids,
> sysvipc_msg_proc_show);
Does that mean /proc interface only gets init_task context?
Along those lines, I think now ipcs -a is incomplete from admin
perspective. Suppose that's a feature from the container/vserver
POV.
> --- work/ipc/util.h~sysvmsg-container 2006-03-06 15:41:56.000000000 -0800
> +++ work-dave/ipc/util.h 2006-03-06 15:41:56.000000000 -0800
> @@ -12,7 +12,7 @@
> #define SEQ_MULTIPLIER (IPCMNI)
>
> void sem_init (void);
> -void msg_init (void);
> +void msg_init (struct ipc_msg_context *context);
> void shm_init (void);
>
> struct ipc_id_ary {
> @@ -30,6 +30,18 @@ struct ipc_ids {
> struct ipc_id_ary* entries;
> };
>
> +struct ipc_msg_context {
> + atomic_t bytes;
> + atomic_t hdrs;
> +
> + struct ipc_ids ids;
> + struct kref count;
> +};
> +
> +struct ipc_context {
> + struct ipc_msg_context msg;
> +};
This looks a little suspect. ref count embedded in embedded object.
My first thought was, sem and shared memory would introduce same, and
now we'd have 3 independent refounts for top level object. However,
it's not used, and doesn't appear to be mirrored in the sem and shared
mem contexts. Perhaps it is just a leftover?
thanks,
-chris
next prev parent reply other threads:[~2006-03-07 1:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-06 23:52 [RFC][PATCH 0/6] support separate namespaces for sysv Dave Hansen
2006-03-06 23:52 ` [RFC][PATCH 1/6] prepare sysctls for containers Dave Hansen
2006-03-07 0:50 ` Herbert Poetzl
2006-03-07 2:00 ` Dave Hansen
2006-03-07 2:45 ` Herbert Poetzl
2006-03-19 15:54 ` Eric W. Biederman
2006-03-07 1:01 ` Chris Wright
2006-03-07 2:04 ` Dave Hansen
2006-03-07 2:18 ` Chris Wright
2006-03-07 3:02 ` Sam Vilain
2006-03-07 1:24 ` Al Viro
2006-03-07 1:55 ` Dave Hansen
2006-03-07 1:57 ` Al Viro
2006-03-19 14:50 ` Eric W. Biederman
2006-03-19 15:29 ` Eric W. Biederman
2006-03-06 23:52 ` [RFC][PATCH 2/6] sysvmsg: containerize Dave Hansen
2006-03-07 1:57 ` Chris Wright [this message]
2006-03-07 2:08 ` Dave Hansen
2006-03-07 2:34 ` Chris Wright
2006-03-19 15:36 ` Eric W. Biederman
2006-03-20 19:34 ` Chris Wright
2006-03-20 21:29 ` Eric W. Biederman
2006-03-20 21:50 ` Chris Wright
2006-03-06 23:52 ` [RFC][PATCH 3/6] sysvmsg: containerize sysctls Dave Hansen
2006-03-06 23:52 ` [RFC][PATCH 4/6] sysvsem: containerize Dave Hansen
2006-03-07 2:44 ` Chris Wright
2006-03-07 5:08 ` Dave Hansen
2006-03-06 23:52 ` [RFC][PATCH 5/6] sysvshm: containerize Dave Hansen
2006-03-06 23:52 ` [RFC][PATCH 6/6] sysvshm: containerize sysctls Dave Hansen
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=20060307015745.GG27645@sorel.sous-sol.org \
--to=chrisw@sous-sol.org \
--cc=clg@fr.ibm.com \
--cc=frankeh@watson.ibm.com \
--cc=haveblue@us.ibm.com \
--cc=herbert@13thfloor.at \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@vilain.net \
--cc=serue@us.ibm.com \
/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
Powered by JetHome