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]
Date:	Tue, 24 Feb 2009 09:59:13 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	mel@....ul.ie, linux-mm@...ck.org, penberg@...helsinki.fi,
	riel@...hat.com, kosaki.motohiro@...fujitsu.com,
	cl@...ux-foundation.org, hannes@...xchg.org, npiggin@...e.de,
	linux-kernel@...r.kernel.org, ming.m.lin@...el.com,
	yanmin_zhang@...ux.intel.com
Subject: Re: [PATCH] mm: gfp_to_alloc_flags()

On Mon, 2009-02-23 at 14:59 -0800, Andrew Morton wrote:
> On Mon, 23 Feb 2009 12:55:03 +0100
> Peter Zijlstra <peterz@...radead.org> wrote:
> 
> > +static int gfp_to_alloc_flags(gfp_t gfp_mask)
> > +{
> > +	struct task_struct *p = current;
> > +	int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET;
> > +	const gfp_t wait = gfp_mask & __GFP_WAIT;
> > +
> > +	/*
> > +	 * The caller may dip into page reserves a bit more if the caller
> > +	 * cannot run direct reclaim, or if the caller has realtime scheduling
> > +	 * policy or is asking for __GFP_HIGH memory.  GFP_ATOMIC requests will
> > +	 * set both ALLOC_HARDER (!wait) and ALLOC_HIGH (__GFP_HIGH).
> > +	 */
> > +	if (gfp_mask & __GFP_HIGH)
> > +		alloc_flags |= ALLOC_HIGH;
> 
> This could be sped up by making ALLOC_HIGH==__GFP_HIGH (hack)

:-) 

> But really, the whole function can be elided on the fastpath.  Try the
> allocation with the current flags (and __GFP_NOWARN) and only if it
> failed will we try altering the flags to try harder?

It is slowpath only.

After Mel's patches the fast path looks like so:

        page = __get_page_from_freelist(gfp_mask|__GFP_HARDWALL, nodemask, order,
                        zonelist, high_zoneidx, ALLOC_WMARK_LOW|ALLOC_CPUSET,
                        preferred_zone, migratetype);
        if (unlikely(!page))
                page = __alloc_pages_slowpath(gfp_mask, order,
                                zonelist, high_zoneidx, nodemask,
                                preferred_zone, migratetype);


and gfp_to_alloc_flags() is only used in __alloc_pages_slowpath().
--
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