From patchwork Fri Oct 2 05:04:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 34804 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id B3DF3B7BE5 for ; Fri, 2 Oct 2009 15:03:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754882AbZJBFC7 (ORCPT ); Fri, 2 Oct 2009 01:02:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754321AbZJBFC6 (ORCPT ); Fri, 2 Oct 2009 01:02:58 -0400 Received: from cantor.suse.de ([195.135.220.2]:51720 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754151AbZJBFC5 (ORCPT ); Fri, 2 Oct 2009 01:02:57 -0400 Received: from relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 6DC9B90847; Fri, 2 Oct 2009 07:03:01 +0200 (CEST) From: Neil Brown To: David Rientjes Date: Fri, 2 Oct 2009 15:04:10 +1000 MIME-Version: 1.0 Message-ID: <19141.35274.513790.845711@notabene.brown> Cc: Suresh Jayaraman , Linus Torvalds , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, Miklos Szeredi , Wouter Verhelst , Peter Zijlstra , trond.myklebust@fys.uio.no Subject: Re: [PATCH 03/31] mm: expose gfp_to_alloc_flags() In-Reply-To: message from David Rientjes on Thursday October 1 References: <1254405903-15760-1-git-send-email-sjayaraman@suse.de> X-Mailer: VM 7.19 under Emacs 21.4.1 X-face: [Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D X-Mailing-List: netdev@vger.kernel.org On Thursday October 1, rientjes@google.com wrote: > On Thu, 1 Oct 2009, Suresh Jayaraman wrote: > > > From: Peter Zijlstra > > > > Expose the gfp to alloc_flags mapping, so we can use it in other parts > > of the vm. > > > > Signed-off-by: Peter Zijlstra > > Signed-off-by: Suresh Jayaraman > > Nack, these flags are internal to the page allocator and exporting them to > generic VM code is unnecessary. > > The only bit you actually use in your patchset is ALLOC_NO_WATERMARKS to > determine whether a particular allocation can use memory reserves. I'd > suggest adding a bool function that returns whether the current context is > given access to reserves including your new __GFP_MEMALLOC flag and > exporting that instead. That sounds like a very appropriate suggestion, thanks. So something like this? Then change every occurrence of + if (!(gfp_to_alloc_flags(gfpflags) & ALLOC_NO_WATERMARKS)) to + if (!(gfp_has_no_watermarks(gfpflags))) ?? Thanks, NeilBrown --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/mm/internal.h b/mm/internal.h index 22ec8d2..7ff78d6 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -195,6 +195,8 @@ static inline struct page *mem_map_next(struct page *iter, #define __paginginit __init #endif +int gfp_has_no_watermarks(gfp_t gfp_mask); + /* Memory initialisation debug and verification */ enum mminit_level { MMINIT_WARNING, diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bf72055..4b4292a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1782,6 +1782,11 @@ gfp_to_alloc_flags(gfp_t gfp_mask) return alloc_flags; } +int gfp_has_no_watermarks(gfp_t gfp_mask) +{ + return (gfp_to_alloc_flags(gfp_mask) & ALLOC_NO_WATERMARKS); +} + static inline struct page * __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, struct zonelist *zonelist, enum zone_type high_zoneidx,