public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Nikita Yushchenko <nyushchenko@dev.rtsoft.ru>,
	linux-rt-users@vger.kernel.org,
	"'Alexey Lugovskoy'" <lugovskoy@dev.rtsoft.ru>,
	Konstantin Kholopov <kkholopov@dev.rtsoft.ru>,
	linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [v3.10-rt / v3.12-rt] scheduling while atomic in cgroup code
Date: Tue, 17 Feb 2015 10:28:32 +0100	[thread overview]
Message-ID: <20150217092832.GC26177@linutronix.de> (raw)
In-Reply-To: <1403338188.6766.6.camel@marge.simpson.net>

* Mike Galbraith | 2014-06-21 10:09:48 [+0200]:

>--- a/mm/memcontrol.c
>+++ b/mm/memcontrol.c
>@@ -2398,16 +2398,18 @@ static bool consume_stock(struct mem_cgr
> {
> 	struct memcg_stock_pcp *stock;
> 	bool ret = true;
>+	int cpu;
> 
> 	if (nr_pages > CHARGE_BATCH)
> 		return false;
> 
>-	stock = &get_cpu_var(memcg_stock);
>+	cpu = get_cpu_light();
>+	stock = &per_cpu(memcg_stock, cpu);
> 	if (memcg == stock->cached && stock->nr_pages >= nr_pages)
> 		stock->nr_pages -= nr_pages;
> 	else /* need to call res_counter_charge */
> 		ret = false;
>-	put_cpu_var(memcg_stock);
>+	put_cpu_light();
> 	return ret;
> }

I am not taking this chunk. That preempt_disable() is lower weight
and there is nothing happening that does not work with it.

>@@ -2457,14 +2459,17 @@ static void __init memcg_stock_init(void
>  */
> static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages)
> {
>-	struct memcg_stock_pcp *stock = &get_cpu_var(memcg_stock);
>+	struct memcg_stock_pcp *stock;
>+	int cpu = get_cpu_light();
>+
>+	stock = &per_cpu(memcg_stock, cpu);
> 
> 	if (stock->cached != memcg) { /* reset if necessary */
> 		drain_stock(stock);
> 		stock->cached = memcg;
> 	}

I am a little more worried that drain_stock() could be called more than
once on the same CPU.
- memcg_cpu_hotplug_callback() doesn't disable preemption
- drain_local_stock() doesn't as well

so maybe it doesn't matter.

> 	stock->nr_pages += nr_pages;
>-	put_cpu_var(memcg_stock);
>+	put_cpu_light();
> }

Sebastian

      reply	other threads:[~2015-02-17  9:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-21  3:55 [v3.10-rt / v3.12-rt] scheduling while atomic in cgroup code Nikita Yushchenko
2014-06-21  8:09 ` Mike Galbraith
2015-02-17  9:28   ` Sebastian Andrzej Siewior [this message]

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=20150217092832.GC26177@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=kkholopov@dev.rtsoft.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=lugovskoy@dev.rtsoft.ru \
    --cc=nyushchenko@dev.rtsoft.ru \
    --cc=rostedt@goodmis.org \
    --cc=umgwanakikbuti@gmail.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