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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 523CEC432BE for ; Mon, 9 Aug 2021 08:41:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DB08561019 for ; Mon, 9 Aug 2021 08:41:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DB08561019 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 44D058D000E; Mon, 9 Aug 2021 04:41:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FD548D0003; Mon, 9 Aug 2021 04:41:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2EBA18D000E; Mon, 9 Aug 2021 04:41:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id 127FF8D0003 for ; Mon, 9 Aug 2021 04:41:43 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A3A778249980 for ; Mon, 9 Aug 2021 08:41:42 +0000 (UTC) X-FDA: 78454898844.01.7801B12 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf07.hostedemail.com (Postfix) with ESMTP id 17AD71009D6C for ; Mon, 9 Aug 2021 08:41:41 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B3C351FDA8; Mon, 9 Aug 2021 08:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1628498500; 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=K6FleGU+Vjel8oStWbGJNmI2TOAKUwObhLh2qqJEUkQ=; b=PcJDwHo0UzeYJns4EM1QpLxbC4zsRy7ZWZMAgi3m5nhbj+qP7O9UAg1JjMI07rmR3kKccw QMWd37DUAY1ytkpwlPaSkPQvGx5xOBluGRkwCSwb2ISuaIV9aESW/9ONExVsO/zmOlNMlp ZVCCj4CO5DbdKFEn2A2bhon1jr2uVdU= 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 8D41BA3B8C; Mon, 9 Aug 2021 08:41:40 +0000 (UTC) Date: Mon, 9 Aug 2021 10:41:40 +0200 From: Michal Hocko To: Feng Tang Cc: linux-mm@kvack.org, Andrew Morton , David Rientjes , Dave Hansen , Ben Widawsky , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Andrea Arcangeli , Mel Gorman , Mike Kravetz , Randy Dunlap , Vlastimil Babka , Andi Kleen , Dan Williams , ying.huang@intel.com Subject: Re: [PATCH v7 3/5] mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY Message-ID: References: <1627970362-61305-1-git-send-email-feng.tang@intel.com> <1627970362-61305-4-git-send-email-feng.tang@intel.com> <20210809024430.GA46432@shbuild999.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210809024430.GA46432@shbuild999.sh.intel.com> Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=PcJDwHo0; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf07.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Stat-Signature: mu86sdo99hpcxfwyqugt6oize7gx1us7 X-Rspamd-Queue-Id: 17AD71009D6C X-Rspamd-Server: rspam01 X-HE-Tag: 1628498501-502634 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon 09-08-21 10:44:30, Feng Tang wrote: > Hi Michal, > > Thanks for the review and ACKs to 1/5 and 2/5 patches. > > On Fri, Aug 06, 2021 at 03:35:48PM +0200, Michal Hocko wrote: > > On Tue 03-08-21 13:59:20, Feng Tang wrote: > > > From: Ben Widawsky > > > > > > Implement the missing huge page allocation functionality while obeying > > > the preferred node semantics. This is similar to the implementation > > > for general page allocation, as it uses a fallback mechanism to try > > > multiple preferred nodes first, and then all other nodes. > > > > > > [akpm: fix compling issue when merging with other hugetlb patch] > > > [Thanks to 0day bot for catching the missing #ifdef CONFIG_NUMA issue] > > > Link: https://lore.kernel.org/r/20200630212517.308045-12-ben.widawsky@intel.com > > > Suggested-by: Michal Hocko > > > Signed-off-by: Ben Widawsky > > > Co-developed-by: Feng Tang > > > Signed-off-by: Feng Tang > > > > ifdefery is just ugly as hell. One way to get rid of that would be to > > provide a mpol_is_preferred_many() wrapper and hide the CONFIG_NUMA in > > mempolicy.h. I haven't checked but this might help to remove some other > > ifdefery as well. > > > > I especially dislike the label hidden in the ifdef. You can get rid of > > that by checking the page for NULL. > > Yes, the 'ifdef's were annoying to me too, and thanks for the suggestions. > Following is the revised patch upon the suggestion. > > Thanks, > Feng > > -------8<--------------------- > > >From fc30718c40f02ba5ea73456af49173e66b5032c1 Mon Sep 17 00:00:00 2001 > From: Ben Widawsky > Date: Thu, 5 Aug 2021 23:01:11 -0400 > Subject: [PATCH] mm/hugetlb: add support for mempolicy MPOL_PREFERRED_MANY > > Implement the missing huge page allocation functionality while obeying the > preferred node semantics. This is similar to the implementation for > general page allocation, as it uses a fallback mechanism to try multiple > preferred nodes first, and then all other nodes. > > To avoid adding too many "#ifdef CONFIG_NUMA" check, add a helper function > in mempolicy.h to check whether a mempolicy is MPOL_PREFERRED_MANY. > > [akpm: fix compling issue when merging with other hugetlb patch] > [Thanks to 0day bot for catching the !CONFIG_NUMA compiling issue] > [Michal Hocko: suggest to remove the #ifdef CONFIG_NUMA check] > Link: https://lore.kernel.org/r/20200630212517.308045-12-ben.widawsky@intel.com > Link: https://lkml.kernel.org/r/1627970362-61305-4-git-send-email-feng.tang@intel.com > Suggested-by: Michal Hocko > Signed-off-by: Ben Widawsky > Co-developed-by: Feng Tang > Signed-off-by: Feng Tang Yeah. This looks much better. Thanks! Acked-by: Michal Hocko Do you think you can provide same helpers for other policies as well? Maybe we can get rid of some other ifdefery as well. Thanks! -- Michal Hocko SUSE Labs