lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 03 Feb 2010 15:09:06 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	John Kacur <jkacur@...hat.com>
Cc:	lkml <linux-kernel@...r.kernel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Rik van Riel <riel@...hat.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Minchan Kim <minchan.kim@...il.com>, linux-mm@...ck.org
Subject: Re: [RFC][PATCH] vmscan: balance local_irq_disable() and
 local_irq_enable()

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@...hat.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.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ