linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: rostedt@goodmis.org
Cc: lkml <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Minchan Kim <minchan.kim@gmail.com>,
	linux-mm@kvack.org
Subject: Re: [RFC][PATCH] vmscan: balance local_irq_disable() and local_irq_enable()
Date: Wed, 3 Feb 2010 21:12:46 +0100	[thread overview]
Message-ID: <520f0cf11002031212p4f1497e3he82dce3af668e676@mail.gmail.com> (raw)
In-Reply-To: <1265227746.24386.15.camel@gandalf.stny.rr.com>

On Wed, Feb 3, 2010 at 9:09 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> t On Wed, 2010-02-03 at 20:53 +0100, John Kacur wrote:
>> Balance local_irq_disable() and local_irq_enable() as well as
>> spin_lock_irq() and spin_lock_unlock_irq
>>
>> Signed-off-by: John Kacur <jkacur@redhat.com>
>> ---
>>  mm/vmscan.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index c26986c..b895025 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1200,8 +1200,9 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
>>               if (current_is_kswapd())
>>                       __count_vm_events(KSWAPD_STEAL, nr_freed);
>>               __count_zone_vm_events(PGSTEAL, zone, nr_freed);
>> +             local_irq_enable();
>>
>> -             spin_lock(&zone->lru_lock);
>> +             spin_lock_irq(&zone->lru_lock);
>>               /*
>>                * Put back any unfreeable pages.
>>                */
>
>
> The above looks wrong. I don't know the code, but just by looking at
> where the locking and interrupts are, I can take a guess.
>
> Lets add a little more of the code:
>
>                local_irq_disable();
>                if (current_is_kswapd())
>                        __count_vm_events(KSWAPD_STEAL, nr_freed);
>                __count_zone_vm_events(PGSTEAL, zone, nr_freed);
>
>                spin_lock(&zone->lru_lock);
>                /*
>
> I'm guessing the __count_zone_vm_events and friends need interrupts
> disabled here, probably due to per cpu stuff. But if you enable
> interrupts before the spin_lock() you may let an interrupt come in and
> invalidate what was done above it.
>
> So no, I do not think enabling interrupts here is a good thing.
>

okay, and since we have already done local_irq_disable(), then that is
why we only need the spin_lock() and not the spin_lock_irq() flavour?

--
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>

  reply	other threads:[~2010-02-03 20:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03 19:53 [RFC][PATCH] vmscan: Unbalanced local_irq_disable and enable John Kacur
2010-02-03 19:53 ` [RFC][PATCH] vmscan: balance local_irq_disable() and local_irq_enable() John Kacur
2010-02-03 20:09   ` Steven Rostedt
2010-02-03 20:12     ` John Kacur [this message]
2010-02-04  0:22       ` KOSAKI Motohiro
2010-02-05 16:05         ` John Kacur

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=520f0cf11002031212p4f1497e3he82dce3af668e676@mail.gmail.com \
    --to=jkacur@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=mingo@elte.hu \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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).