From: "Paul (宝瑠) Menage" <menage@google.com>
To: balbir@linux.vnet.ibm.com
Cc: "Pavel Emelianov" <xemul@sw.ru>,
"linux kernel mailing list" <linux-kernel@vger.kernel.org>,
"Paul Jackson" <pj@sgi.com>,
"Linux Containers" <containers@lists.osdl.org>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: Containers: css_put() dilemma
Date: Mon, 16 Jul 2007 19:35:01 -0700 [thread overview]
Message-ID: <6599ad830707161935n69776f1t98292fc9990f4766@mail.gmail.com> (raw)
In-Reply-To: <469C2792.6050009@linux.vnet.ibm.com>
On 7/16/07, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
> - if (notify_on_release(cont)) {
> + if (atomic_dec_and_test(&css->refcnt) && notify_on_release(cont)) {
This seems like a good idea, as long as atomic_dec_and_test() isn't
noticeably more expensive than atomic_dec(). I assume it shouldn't
need to be, since the bus locking operations are presumably the same
in each case.
> mutex_lock(&container_mutex);
> set_bit(CONT_RELEASABLE, &cont->flags);
> - if (atomic_dec_and_test(&css->refcnt)) {
> - check_for_release(cont);
> - }
> + check_for_release(cont);
> mutex_unlock(&container_mutex);
>
> That way we set the CONT_RELEASABLE bit only when the ref count drops
> to zero.
>
That's probably a good idea, in conjunction with another part of my
patch for this that frees container objects under RCU - as soon as you
do the atomic_dec_and_test(), then in theory some other thread could
delete the container (since we're no longer going to be taking
container_mutex in this function). But as long as the container object
remains valid until synchronize_rcu() completes, then we can safely
set the CONT_RELEASABLE bit on it.
>
> Yes, that is correct, the advantage is that with can_destroy() we
> don't need to go through release synchronization each time we do
> a css_put().
I think the amount of release synchronization *needed* is going to be
the same whether you have the refcounting done in the subsystem or in
the framework. But I agree that right now we're doing one more atomic
op than we strictly need to, and can remove it.
Paul
next prev parent reply other threads:[~2007-07-17 2:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-16 18:50 Balbir Singh
2007-07-16 19:03 ` Paul (宝瑠) Menage
2007-07-17 2:21 ` Balbir Singh
2007-07-17 2:35 ` Paul (宝瑠) Menage [this message]
2007-07-17 7:00 ` Balbir Singh
2007-07-17 7:18 ` Paul (宝瑠) Menage
2007-07-17 10:28 ` Balbir Singh
2007-07-17 15:49 ` Paul (宝瑠) Menage
2007-07-17 16:02 ` Dave Hansen
2007-07-17 16:15 ` Paul (宝瑠) Menage
2007-07-17 17:23 ` Paul Jackson
2007-07-17 17:40 ` Balbir Singh
2007-07-17 17:44 ` Paul (宝瑠) Menage
2007-07-17 17:55 ` Paul Jackson
2007-07-17 17:57 ` Paul (宝瑠) Menage
2007-07-17 18:11 ` Balbir Singh
2007-07-17 18:26 ` Paul (宝瑠) Menage
2007-07-18 4:29 ` Balbir Singh
2007-07-18 5:30 ` Balbir Singh
2007-07-18 5:52 ` Srivatsa Vaddagiri
2007-07-18 23:15 ` Paul Menage
2007-07-19 3:44 ` Balbir Singh
2007-07-18 6:07 ` Paul (宝瑠) Menage
2007-07-17 17:53 ` Paul Jackson
2007-07-17 17:55 ` Paul (宝瑠) Menage
2007-07-17 17:58 ` Paul Jackson
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=6599ad830707161935n69776f1t98292fc9990f4766@mail.gmail.com \
--to=menage@google.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pj@sgi.com \
--cc=xemul@sw.ru \
/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
all inboxes | Powered by JetHome®