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-prev] [day] [month] [year] [list]
Date:	Thu, 15 Dec 2011 09:06:27 +0800
From:	Shaohua Li <shaohua.li@...el.com>
To:	Mike Waychison <mikew@...gle.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Mel Gorman <mgorman@...e.de>,
	Minchan Kim <minchan.kim@...il.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Johannes Weiner <jweiner@...hat.com>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Hugh Dickens <hughd@...gle.com>,
	Greg Thelen <gthelen@...gle.com>
Subject: Re: [PATCH] mm: Fix kswapd livelock on single core, no preempt
 kernel

On Wed, 2011-12-14 at 12:45 +0800, Mike Waychison wrote:
> On Tue, Dec 13, 2011 at 8:36 PM, Mike Waychison <mikew@...gle.com> wrote:
> > On Tue, Dec 13, 2011 at 6:24 PM, Shaohua Li <shaohua.li@...el.com> wrote:
> >> On Wed, 2011-12-14 at 01:44 +0800, Mike Waychison wrote:
> >>> On a single core system with kernel preemption disabled, it is possible
> >>> for the memory system to be so taxed that kswapd cannot make any forward
> >>> progress.  This can happen when most of system memory is tied up as
> >>> anonymous memory without swap enabled, causing kswapd to consistently
> >>> fail to achieve its watermark goals.  In turn, sleeping_prematurely()
> >>> will consistently return true and kswapd_try_to_sleep() to never invoke
> >>> schedule().  This causes the kswapd thread to stay on the CPU in
> >>> perpetuity and keeps other threads from processing oom-kills to reclaim
> >>> memory.
> >>>
> >>> The cond_resched() instance in balance_pgdat() is never called as the
> >>> loop that iterates from DEF_PRIORITY down to 0 will always set
> >>> all_zones_ok to true, and not set it to false once we've passed
> >>> DEF_PRIORITY as zones that are marked ->all_unreclaimable are not
> >>> considered in the "all_zones_ok" evaluation.
> >>>
> >>> This change modifies kswapd_try_to_sleep to ensure that we enter
> >>> scheduler at least once per invocation if needed.  This allows kswapd to
> >>> get off the CPU and allows other threads to die off from the OOM killer
> >>> (freeing memory that is otherwise unavailable in the process).
> >> your description suggests zones with all_unreclaimable set. but in this
> >> case sleeping_prematurely() will return false instead of true, kswapd
> >> will do sleep then. is there anything I missed?
> 
> Actually, I don't see where sleeping_prematurely() would return false
> if any zone has ->all_unreclaimable set.   In this case, the order was
> 0, so we return !all_zones_ok, which is false because
> !zone_watermark_ok_safe(ZONE_DMA32).
so the ZONE_DMA32 hasn't all_unreclaimable set, right? if all zones have
all_unreclaimable set, all_zones_ok clearly is true. this means kswapd
can reclaim some pages in the zone, which looks sane.

Thanks,
Shaohua

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