From: mingming cao <cmm@us.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@digeo.com>,
hugh@veritas.com, manfred@colorfullife.com,
linux-kernel@vger.kernel.org, dipankar@in.ibm.com,
lse-tech@lists.sourceforge.net
Subject: Re: [PATCH]updated ipc lock patch
Date: Thu, 24 Oct 2002 22:53:54 -0700 [thread overview]
Message-ID: <3DB8DC72.6A08C74F@us.ibm.com> (raw)
In-Reply-To: 20021025141829.063a4e66.rusty@rustcorp.com.au
Rusty Russell wrote:
>
>
> Here's my brief audit:
>
> >+ int max_id = ids->max_id;
> >
> >- for (id = 0; id <= ids->max_id; id++) {
> >+ read_barrier_depends();
> >+ for (id = 0; id <= max_id; id++) {
>
> That needs to be a rmb(), not a read_barrier_depends().
Thanks for spending some time reviewing the barriers for me. While I was
thinking the reason why a rmb is needed here, I found that maybe we
don't need a barrier here at all. Since ipc_findkey()(the code above)
and the grow_ary() are both protected by ipc_ids.sem(there missing
document for this), so both the max_id and the the entries array seen by
ipc_findkey should be the latest one.
Also I think it's safe to remove the rmb() in ipc_get() for the same
reason. ipc_get() is only used by shm_get_stat() through shm_get() and
is called with the shm_ids.sem protected. (Maybe ipc_get should be
removed totally?)
> And like all
> barriers, it *requires* a comment:
> /* We must read max_id before reading any entries */
>
Sure. I will add such comments on all places where barriers are being
used. I will do as much as I can to add more comments in the code about
what lock/sem are hold before/after the funtion is called.:-)
> I can't see the following in the patch posted, but:
> > void ipc_rcu_free(void* ptr, int size)
> > {
> > struct rcu_ipc_free* arg;
> >
> > arg = (struct rcu_ipc_free *) kmalloc(sizeof(*arg), GFP_KERNEL);
> > if (arg == NULL)
> > return;
> > arg->ptr = ptr;
> > arg->size = size;
> > call_rcu(&arg->rcu_head, ipc_free_callback, arg);
> > }
>
> This is unacceptable crap, sorry. You *must* allocate the resources
> required to free the object *at the time you allocate the object*,
> since freeing must not fail.
>
> > Even better: is it possible to embed the rcu_ipc_free inside the
> > object-to-be-freed? Perhaps not?
>
> Yes, this must be done.
>
I thought about embed rcu_ipc_free inside the ipc_ids structure before.
But there could be a problem if grow_ary() is called again before the
old array associated with the previous grow_ary() has not scheduled to
be freed yet. I see a need to do that now, as you made very good point.
I will make the changes tomorrow.
Thanks a lot for your comments.
Mingming
next prev parent reply other threads:[~2002-10-25 5:53 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-18 0:14 [PATCH]IPC locks breaking down with RCU mingming cao
2002-10-20 13:14 ` Hugh Dickins
2002-10-20 17:27 ` Hugh Dickins
2002-10-21 18:11 ` mingming cao
2002-10-21 19:00 ` Hugh Dickins
2002-10-24 21:49 ` [PATCH]updated ipc lock patch mingming cao
2002-10-24 22:29 ` Andrew Morton
2002-10-24 22:56 ` Hugh Dickins
2002-10-24 23:30 ` Andrew Morton
2002-10-24 23:59 ` Hugh Dickins
2002-10-25 0:35 ` [Lse-tech] " Rick Lindsley
2002-10-25 1:07 ` Robert Love
2002-10-25 0:07 ` mingming cao
2002-10-25 0:24 ` Andrew Morton
2002-10-25 4:18 ` Rusty Russell
2002-10-25 5:53 ` mingming cao [this message]
2002-10-25 7:27 ` Rusty Russell
2002-10-25 5:36 ` Manfred Spraul
2002-10-25 16:53 ` Rik van Riel
2002-10-24 23:23 ` mingming cao
2002-10-25 14:21 ` [Lse-tech] " Paul Larson
2002-10-25 17:17 ` mingming cao
2002-10-25 18:20 ` Paul Larson
2002-10-25 18:51 ` mingming cao
2002-10-25 19:06 ` Paul Larson
2002-10-25 20:14 ` mingming cao
2002-10-25 20:23 ` Manfred Spraul
2002-10-25 0:38 ` Cliff White
2002-10-31 17:52 ` [Lse-tech] Re: [PATCH]updated ipc lock patch [PERFORMANCE RESULTS] Bill Hartner
2002-10-21 19:18 ` [PATCH]IPC locks breaking down with RCU Dipankar Sarma
2002-10-21 19:36 ` Hugh Dickins
2002-10-21 19:41 ` mingming cao
2002-10-21 20:14 ` Dipankar Sarma
2002-10-21 18:07 ` mingming cao
-- strict thread matches above, loose matches on Subject: below --
2002-10-25 17:20 [PATCH]updated ipc lock patch Cliff White
[not found] <Pine.LNX.4.44.0210270748560.1704-100000@localhost.localdomain>
2002-10-28 1:06 ` Rusty Russell
2002-10-28 14:21 ` Hugh Dickins
2002-10-28 21:47 ` Rusty Russell
2002-10-29 0:26 ` Hugh Dickins
2002-10-29 2:51 ` Rusty Russell
2002-10-28 20:00 ` Dipankar Sarma
2002-10-28 21:41 ` Rusty Russell
2002-10-29 6:11 ` Dipankar Sarma
2002-10-28 22:07 ` mingming cao
2002-10-29 1:06 ` Rusty Russell
2002-10-28 1:15 Rusty Russell
2002-10-28 1:35 ` Davide Libenzi
2002-10-28 4:10 ` Rusty Russell
2002-10-28 17:08 ` Davide Libenzi
2002-10-28 22:39 ` Rusty Russell
2002-10-28 23:52 ` Davide Libenzi
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=3DB8DC72.6A08C74F@us.ibm.com \
--to=cmm@us.ibm.com \
--cc=akpm@digeo.com \
--cc=dipankar@in.ibm.com \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lse-tech@lists.sourceforge.net \
--cc=manfred@colorfullife.com \
--cc=rusty@rustcorp.com.au \
/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;
as well as URLs for NNTP newsgroup(s).