All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Shi <yang.shi@windriver.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: <linux-rt-users@vger.kernel.org>, <paul.gortmaker@windriver.com>
Subject: Re: [PATCH 1/2] rt: Don't call schedule_work_on in preemption disabled context
Date: Fri, 4 Oct 2013 09:36:41 -0700	[thread overview]
Message-ID: <524EEE99.1060907@windriver.com> (raw)
In-Reply-To: <20131004154616.GJ19953@linutronix.de>

On 10/4/2013 8:46 AM, Sebastian Andrzej Siewior wrote:
> * Yang Shi | 2013-09-16 14:09:18 [-0700]:
>
>> ---
>> mm/memcontrol.c |    5 ++++-
>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 82a187a..9f7cc0f 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
>> @@ -2453,8 +2453,11 @@ static void drain_all_stock(struct mem_cgroup *root_memcg, bool sync)
>> 		if (!test_and_set_bit(FLUSHING_CACHED_CHARGE, &stock->flags)) {
>> 			if (cpu == curcpu)
>> 				drain_local_stock(&stock->work);
>> -			else
>> +			else {
>> +				preempt_enable();
>> 				schedule_work_on(cpu, &stock->work);
>> +				preempt_disable();
>> +			}
>> 		}
> What ensures that you don't switch CPUs between preempt_enable() &
> preempt_disable() and is curcpu != smp_processor_id() ?

drain_all_stock is called by drain_all_stock_async or 
drain_all_stock_sync, and the call in both is protected by mutex:

if (!mutex_trylock(&percpu_charge_mutex))
                 return;
         drain_all_stock(root_memcg, false);
         mutex_unlock(&percpu_charge_mutex);


So, I suppose this should be able to protect from migration?

Thanks,
Yang

>
> What about removing the get_cpu() & put_cpu() calls (and the shortcut)?
>
>> 	}
>> 	put_cpu();
> Sebastian


  reply	other threads:[~2013-10-04 16:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16 21:09 Fix two sleeping function called in atomic context bug Yang Shi
2013-09-16 21:09 ` [PATCH 1/2] rt: Don't call schedule_work_on in preemption disabled context Yang Shi
2013-10-04 15:46   ` Sebastian Andrzej Siewior
2013-10-04 16:36     ` Yang Shi [this message]
2013-10-04 17:10       ` Sebastian Andrzej Siewior
2013-10-04 17:49         ` Yang Shi
2013-10-04 17:56           ` Sebastian Andrzej Siewior
2013-09-16 21:09 ` [PATCH 2/2] rt: Move schedule_work call to helper thread Yang Shi
2013-10-04 17:11   ` Sebastian Andrzej Siewior

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=524EEE99.1060907@windriver.com \
    --to=yang.shi@windriver.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=paul.gortmaker@windriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.