From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5F35C433FE for ; Tue, 14 Sep 2021 08:18:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AEA29610D1 for ; Tue, 14 Sep 2021 08:18:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230383AbhINIT0 (ORCPT ); Tue, 14 Sep 2021 04:19:26 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:59132 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229805AbhINITN (ORCPT ); Tue, 14 Sep 2021 04:19:13 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 33098200DA; Tue, 14 Sep 2021 08:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1631607473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FmdG8PcnuIQuqHtdoYXiNJLHdhDIQt4J2A8/AC35I5c=; b=IEJQ2TEznajvCNl1nH6A7iIwCu5Yz2J4O6kJpMm04Zzijue7NO/Y3POHnHOX/b/kVKP4jV J+NBflkpoVjrX5prgNDVxIDkMc5fP1DKHCuipbUuWPRYs87/FbhXcV/LjmatEWuDCKSPaZ sC94sWIZJ7yhH2Qaf8zqyF2fSfFK1d4= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 94D58A3B88; Tue, 14 Sep 2021 08:17:52 +0000 (UTC) Date: Tue, 14 Sep 2021 10:17:52 +0200 From: Michal Hocko To: Vlastimil Babka Cc: Feng Tang , Andrew Morton , David Rientjes , Tejun Heo , Zefan Li , Johannes Weiner , Mel Gorman , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] mm/page_alloc: detect allocation forbidden by cpuset and bail out early Message-ID: References: <1631590828-25565-1-git-send-email-feng.tang@intel.com> <24d89efa-502f-e31a-5d45-536352485bbb@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24d89efa-502f-e31a-5d45-536352485bbb@suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 14-09-21 10:01:26, Vlastimil Babka wrote: > On 9/14/21 05:40, Feng Tang wrote: [...] > > +/* Whether the 'nodes' are all movable nodes */ > > +static inline bool movable_only_nodes(nodemask_t *nodes) > > +{ > > + struct zonelist *zonelist; > > + struct zoneref *z; > > + > > + if (nodes_empty(*nodes)) > > + return false; > > + > > + zonelist = > > + &NODE_DATA(first_node(*nodes))->node_zonelists[ZONELIST_FALLBACK]; > > + z = first_zones_zonelist(zonelist, ZONE_NORMAL, nodes); > > + return (!z->zone) ? true : false; > > +} > > Hmm, could all that become just this? > > !nodes_intersects(&node_states[N_NORMAL_MEMORY], nodes) Maybe yes but I find the zonelist approach much easier to follow even though the code looks more complex at first sight. It talks about an empty zone list for ZONE_NORMAL request which is quite clear from the scribble. I always have to re-learn how the N*MEMORY works TBH. Maybe this is just me though. -- Michal Hocko SUSE Labs