Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932683Ab3GVLeA (ORCPT ); Mon, 22 Jul 2013 07:34:00 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:30756 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754075Ab3GVLd6 (ORCPT ); Mon, 22 Jul 2013 07:33:58 -0400 X-AuditID: cbfee690-b7f6f6d00000740c-24-51ed18a5e201 From: Pintu Kumar To: akpm@linux-foundation.org, mgorman@suse.de, jiang.liu@huawei.com, minchan@kernel.org, cody@linux.vnet.ibm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: cpgs@samsung.com, pintu.k@samsung.com, pintu_agarwal@yahoo.com Subject: [PATCH 2/2] mm: page_alloc: avoid slowpath for more than MAX_ORDER allocation. Date: Mon, 22 Jul 2013 17:02:42 +0530 Message-id: <1374492762-17735-1-git-send-email-pintu.k@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRmVeSWpSXmKPExsWyRsSkWnepxNtAgzlXxC3mrF/DZrH5eg+7 xctDmhb3v89ls7i8aw6bxb01/1ktJr97xmix7Ot7dou+74fZLb69vc3uwOXRcuQtq8emVZ1s Hps+TWL3ODHjN4vHg0ObWTz6tqxi9Nh8utrj8yY5j1mzDjMFcEZx2aSk5mSWpRbp2yVwZfxf eYap4B9bxZTHB9gaGO+wdjFyckgImEhMe74CyhaTuHBvPRuILSSwlFHi+G1tmJoVLW3sXYxc QPFFjBIfd81igijqYZK4vtESxGYTUJf48eY3I0iRiMByRomF+58xdzFycDALOEmc3ZwCUiMs EClxZu8FsAUsAqoS/adesIPYvALOElv3nGEFKZcQUJCYM8kGZIyEwC52iS1bOhkh6gUkvk0+ xAJRIyux6QAzxG2SEgdX3GCZwCi4gJFhFaNoakFyQXFSepGJXnFibnFpXrpecn7uJkZg0J/+ 92zCDsZ7B6wPMSYDjZvILCWan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mTbn/q80838tey3 sxdNegsn9sj5P902v0tqurfE7x3dJ/0/a+ov0gkPXL87WMqFV2uy5LPsTROtfh5jDmjzWuHS KKrEUpyRaKjFXFScCAAKh3/y7gIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1110 Lines: 34 It was observed that if order is passed as more than MAX_ORDER allocation in __alloc_pages_nodemask, it will unnecessarily go to slowpath and then return failure. Since we know that more than MAX_ORDER will anyways fail, we can avoid slowpath by returning failure in nodemask itself. Signed-off-by: Pintu Kumar --- mm/page_alloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 202ab58..6d38e75 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1564,6 +1564,10 @@ __setup("fail_page_alloc=", setup_fail_page_alloc); static bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) { + if (order >= MAX_ORDER) { + WARN_ON(!(gfp_mask & __GFP_NOWARN)); + return false; + } if (order < fail_page_alloc.min_order) return false; if (gfp_mask & __GFP_NOFAIL) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/