From: yamamoto@valinux.co.jp (YAMAMOTO Takashi)
To: xemul@openvz.org
Cc: containers@lists.osdl.org, linux-mm@kvack.org, menage@google.com,
balbir@linux.vnet.ibm.com
Subject: Re: [PATCH 2/2] Make res_counter hierarchical
Date: Thu, 13 Mar 2008 08:36:50 +0900 (JST) [thread overview]
Message-ID: <20080312233650.363181E705C@siro.lan> (raw)
In-Reply-To: Your message of "Thu, 13 Mar 2008 08:05:41 +0900 (JST)" <20080312230541.CB9021E703D@siro.lan>
> > @@ -36,10 +37,26 @@ int res_counter_charge(struct res_counter *counter, unsigned long val)
> > {
> > int ret;
> > unsigned long flags;
> > + struct res_counter *c, *unroll_c;
> > +
> > + local_irq_save(flags);
> > + for (c = counter; c != NULL; c = c->parent) {
> > + spin_lock(&c->lock);
> > + ret = res_counter_charge_locked(c, val);
> > + spin_unlock(&c->lock);
> > + if (ret < 0)
> > + goto unroll;
> > + }
> > + local_irq_restore(flags);
> > + return 0;
> >
> > - spin_lock_irqsave(&counter->lock, flags);
> > - ret = res_counter_charge_locked(counter, val);
> > - spin_unlock_irqrestore(&counter->lock, flags);
> > +unroll:
> > + for (unroll_c = counter; unroll_c != c; unroll_c = unroll_c->parent) {
> > + spin_lock(&unroll_c->lock);
> > + res_counter_uncharge_locked(unroll_c, val);
> > + spin_unlock(&unroll_c->lock);
> > + }
> > + local_irq_restore(flags);
> > return ret;
> > }
>
> what prevents the topology (in particular, ->parent pointers) from
> changing behind us?
>
> YAMAMOTO Takashi
to answer myself: cgroupfs rename doesn't allow topological changes
in the first place.
btw, i think you need to do the same for res_counter_limit_check_locked
as well. i'm skeptical about doing these complicated stuffs in kernel,
esp. in this potentially performance critical code.
YAMAMOTO Takashi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-03-12 23:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-07 15:32 Pavel Emelyanov
2008-03-08 4:45 ` KAMEZAWA Hiroyuki
2008-03-11 8:15 ` Pavel Emelyanov
2008-03-11 8:32 ` KAMEZAWA Hiroyuki
2008-03-11 8:38 ` Pavel Emelyanov
2008-03-11 9:03 ` Daisuke Nishimura
2008-03-11 9:07 ` KAMEZAWA Hiroyuki
2008-03-11 8:57 ` Paul Menage
2008-03-11 9:13 ` KAMEZAWA Hiroyuki
2008-03-11 9:11 ` Paul Menage
2008-03-11 9:16 ` Balbir Singh
2008-03-11 9:39 ` KAMEZAWA Hiroyuki
2008-03-11 9:53 ` Balbir Singh
2008-03-11 10:03 ` KAMEZAWA Hiroyuki
2008-03-11 15:56 ` Paul Menage
2008-03-11 15:59 ` Balbir Singh
2008-03-08 19:06 ` Balbir Singh
2008-03-11 8:17 ` Pavel Emelyanov
2008-03-11 8:24 ` Balbir Singh
2008-03-11 8:40 ` Pavel Emelyanov
2008-03-12 23:05 ` YAMAMOTO Takashi
2008-03-12 23:36 ` YAMAMOTO Takashi [this message]
2008-03-13 8:56 ` Pavel Emelyanov
[not found] ` <47D16004.7050204-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2008-04-02 15:26 ` Balbir Singh
[not found] ` <47F3A5BF.1080301-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2008-04-03 12:26 ` Pavel Emelyanov
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=20080312233650.363181E705C@siro.lan \
--to=yamamoto@valinux.co.jp \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.osdl.org \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
--cc=xemul@openvz.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