From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970114AbdAFKk6 (ORCPT ); Fri, 6 Jan 2017 05:40:58 -0500 Received: from mx2.suse.de ([195.135.220.15]:39557 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967238AbdAFKku (ORCPT ); Fri, 6 Jan 2017 05:40:50 -0500 Date: Fri, 6 Jan 2017 11:40:48 +0100 From: Michal Hocko To: Vlastimil Babka Cc: Andrew Morton , Mel Gorman , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm, page_alloc: don't check cpuset allowed twice in fast-path Message-ID: <20170106104048.GB5561@dhcp22.suse.cz> References: <20170106081805.26132-1-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170106081805.26132-1-vbabka@suse.cz> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 06-01-17 09:18:05, Vlastimil Babka wrote: > Since commit 682a3385e773 ("mm, page_alloc: inline the fast path of the > zonelist iterator") we replace a NULL nodemask with cpuset_current_mems_allowed > in the fast path, so that get_page_from_freelist() filters nodes allowed by the > cpuset via for_next_zone_zonelist_nodemask(). In that case it's pointless to > also check __cpuset_zone_allowed(), which we can avoid by not using > ALLOC_CPUSET in that scenario. OK, this seems to be really worth it as most allocations go via __alloc_pages so we can save __cpuset_zone_allowed in the fast path. I was about to object how fragile this might be wrt. other ALLOC_CPUSET checks but then I've realized this is only for the hotpath as the slowpath goes through gfp_to_alloc_flags() which sets it back on. Maybe all that could be added to the changelog? > Signed-off-by: Vlastimil Babka Acked-by: Michal Hocko > --- > mm/page_alloc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 2c6d5f64feca..3d86fbe2f4f4 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -3754,9 +3754,10 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, > > if (cpusets_enabled()) { > alloc_mask |= __GFP_HARDWALL; > - alloc_flags |= ALLOC_CPUSET; > if (!ac.nodemask) > ac.nodemask = &cpuset_current_mems_allowed; > + else > + alloc_flags |= ALLOC_CPUSET; > } > > gfp_mask &= gfp_allowed_mask; > -- > 2.11.0 > > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org -- Michal Hocko SUSE Labs