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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100903205945.44e1aa38.akpm@linux-foundation.org>
Date:	Fri, 3 Sep 2010 20:59:45 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Wu Fengguang <fengguang.wu@...el.com>
Cc:	Dave Chinner <david@...morbit.com>, Mel Gorman <mel@....ul.ie>,
	Linux Kernel List <linux-kernel@...r.kernel.org>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	Rik van Riel <riel@...hat.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Minchan Kim <minchan.kim@...il.com>,
	Christoph Lameter <cl@...ux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	David Rientjes <rientjes@...gle.com>
Subject: Re: [PATCH 3/3] mm: page allocator: Drain per-cpu lists after
 direct reclaim allocation fails

On Sat, 4 Sep 2010 11:23:11 +0800 Wu Fengguang <fengguang.wu@...el.com> wrote:

> > Still, given the improvements in performance from this patchset,
> > I'd say inclusion is a no-braniner....
> 
> In your case it's not really high memory pressure, but maybe too many
> concurrent direct reclaimers, so that when one reclaimed some free
> pages, others kick in and "steal" the free pages. So we need to kill
> the second cond_resched() call (which effectively gives other tasks a
> good chance to steal this task's vmscan fruits), and only do
> drain_all_pages() when nothing was reclaimed (instead of allocated).

Well...  cond_resched() will only resched when this task has been
marked for preemption.  If that's happening at such a high frequency
then Something Is Up with the scheduler, and the reported context
switch rate will be high.

> Dave, will you give a try of this patch? It's based on Mel's.
> 
> 
> --- linux-next.orig/mm/page_alloc.c	2010-09-04 11:08:03.000000000 +0800
> +++ linux-next/mm/page_alloc.c	2010-09-04 11:16:33.000000000 +0800
> @@ -1850,6 +1850,7 @@ __alloc_pages_direct_reclaim(gfp_t gfp_m
>  
>  	cond_resched();
>  
> +retry:
>  	/* We now go into synchronous reclaim */
>  	cpuset_memory_pressure_bump();
>  	p->flags |= PF_MEMALLOC;
> @@ -1863,26 +1864,23 @@ __alloc_pages_direct_reclaim(gfp_t gfp_m
>  	lockdep_clear_current_reclaim_state();
>  	p->flags &= ~PF_MEMALLOC;
>  
> -	cond_resched();
> -
> -	if (unlikely(!(*did_some_progress)))
> +	if (unlikely(!(*did_some_progress))) {
> +		if (!drained) {
> +			drain_all_pages();
> +			drained = true;
> +			goto retry;
> +		}
>  		return NULL;
> +	}
>  
> -retry:
>  	page = get_page_from_freelist(gfp_mask, nodemask, order,
>  					zonelist, high_zoneidx,
>  					alloc_flags, preferred_zone,
>  					migratetype);
>  
> -	/*
> -	 * If an allocation failed after direct reclaim, it could be because
> -	 * pages are pinned on the per-cpu lists. Drain them and try again
> -	 */
> -	if (!page && !drained) {
> -		drain_all_pages();
> -		drained = true;
> +	/* someone steal our vmscan fruits? */
> +	if (!page && *did_some_progress)
>  		goto retry;
> -	}

Perhaps the fruit-stealing event is worth adding to the
userspace-exposed vm stats somewhere.  But not in /proc - somewhere
more temporary, in debugfs.

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