From patchwork Thu Oct 1 14:05:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suresh Jayaraman X-Patchwork-Id: 34696 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 2029EB7B99 for ; Fri, 2 Oct 2009 00:04:40 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932281AbZJAODx (ORCPT ); Thu, 1 Oct 2009 10:03:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932271AbZJAODw (ORCPT ); Thu, 1 Oct 2009 10:03:52 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:39079 "EHLO victor.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932251AbZJAODv (ORCPT ); Thu, 1 Oct 2009 10:03:51 -0400 Received: from localhost (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by victor.provo.novell.com with ESMTP; Thu, 01 Oct 2009 08:03:44 -0600 From: Suresh Jayaraman To: Linus Torvalds , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: netdev@vger.kernel.org, Neil Brown , Miklos Szeredi , Wouter Verhelst , Peter Zijlstra , trond.myklebust@fys.uio.no, Suresh Jayaraman Subject: [PATCH 03/31] mm: expose gfp_to_alloc_flags() Date: Thu, 1 Oct 2009 19:35:03 +0530 Message-Id: <1254405903-15760-1-git-send-email-sjayaraman@suse.de> X-Mailer: git-send-email 1.6.0.2 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- mm/internal.h | 15 +++++++++++++++ mm/page_alloc.c | 16 +--------------- 2 files changed, 16 insertions(+), 15 deletions(-) -- 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 Index: mmotm/mm/internal.h =================================================================== --- mmotm.orig/mm/internal.h +++ mmotm/mm/internal.h @@ -194,6 +194,21 @@ static inline struct page *mem_map_next( #define __paginginit __init #endif +/* The ALLOC_WMARK bits are used as an index to zone->watermark */ +#define ALLOC_WMARK_MIN WMARK_MIN +#define ALLOC_WMARK_LOW WMARK_LOW +#define ALLOC_WMARK_HIGH WMARK_HIGH +#define ALLOC_NO_WATERMARKS 0x04 /* don't check watermarks at all */ + +/* Mask to get the watermark bits */ +#define ALLOC_WMARK_MASK (ALLOC_NO_WATERMARKS-1) + +#define ALLOC_HARDER 0x10 /* try to alloc harder */ +#define ALLOC_HIGH 0x20 /* __GFP_HIGH set */ +#define ALLOC_CPUSET 0x40 /* check for correct cpuset */ + +int gfp_to_alloc_flags(gfp_t gfp_mask); + /* Memory initialisation debug and verification */ enum mminit_level { MMINIT_WARNING, Index: mmotm/mm/page_alloc.c =================================================================== --- mmotm.orig/mm/page_alloc.c +++ mmotm/mm/page_alloc.c @@ -1190,19 +1190,6 @@ failed: return NULL; } -/* The ALLOC_WMARK bits are used as an index to zone->watermark */ -#define ALLOC_WMARK_MIN WMARK_MIN -#define ALLOC_WMARK_LOW WMARK_LOW -#define ALLOC_WMARK_HIGH WMARK_HIGH -#define ALLOC_NO_WATERMARKS 0x04 /* don't check watermarks at all */ - -/* Mask to get the watermark bits */ -#define ALLOC_WMARK_MASK (ALLOC_NO_WATERMARKS-1) - -#define ALLOC_HARDER 0x10 /* try to alloc harder */ -#define ALLOC_HIGH 0x20 /* __GFP_HIGH set */ -#define ALLOC_CPUSET 0x40 /* check for correct cpuset */ - #ifdef CONFIG_FAIL_PAGE_ALLOC static struct fail_page_alloc_attr { @@ -1691,8 +1678,7 @@ void wake_all_kswapd(unsigned int order, wakeup_kswapd(zone, order); } -static inline int -gfp_to_alloc_flags(gfp_t gfp_mask) +int gfp_to_alloc_flags(gfp_t gfp_mask) { struct task_struct *p = current; int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET;