Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2497498pxt; Mon, 9 Aug 2021 01:43:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyW1OpuQ6/N6GsGqAJTfscsA3Nda8YAXHLjXIiYxZIlIMXp9W2o7DGb60sFBH4za657JMci X-Received: by 2002:a17:906:4a46:: with SMTP id a6mr6721293ejv.252.1628498603817; Mon, 09 Aug 2021 01:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628498603; cv=none; d=google.com; s=arc-20160816; b=dphCEU2nOi1HyzT1YTVm7U9agPrDiC+kUaSCTbjwES2jZnXshLXHaPHnj+Xn+oS1KC ZQlyrwSoXPoKRYahasjCHbY9+bL+X29udIgldu1FQNUljhw1lpaEQreUpwKYJKugUWzz g4iF8g6+hcCqvzYrAvElP22gdUinFxVewe0BDD/9N+GtPf4IGsQ/rxbYjO7c3PNp/kOW /5WzL3Lx/65a9AQo1Qryj/QIKE/dIzIZHYTf9ApoV3XBpntYiFWoISCJ49lkONN5GLBh ocIPIzttwIpCLY4HaAQzKgEw2QzRpR2NOgXokt6Ng9NR1SxRb1dbK6LFtdhxtqz4tBRf fZ+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=K6FleGU+Vjel8oStWbGJNmI2TOAKUwObhLh2qqJEUkQ=; b=Uy3F8bJLvFnVXmuPqBZpz5ZEDWwy57ry6pCgjcUHHi49uBDgeu0SbpDyxTd2eEvFP3 30/NVXJ/5YLcEsCRD4gjvgH78W/BdSCyXTiXgODfAMSzUfG255U+2VLLOG79rEEsqpgQ +/CwdDCWpiOGfW8TxKc7hJ0/mUdIVZoOZSnkMTYFth7NRPQ5Vzx+vhp7E1KdYjJxqYvp Vef8kGhU6WP/+Wj9vgFSAXYH1qiSXTuNmra+jjDSMFki0gncGuQ/cMBxfPqdbtlmuZZm kqUtOCGhIR1JF8MrRMs5pXQ5RPxG4L4xXKJAMwPsbPzfeepmJiOfXlTp/YF7TyeNXKJF Y7ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=PcJDwHo0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si17195978edw.371.2021.08.09.01.43.00; Mon, 09 Aug 2021 01:43:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=PcJDwHo0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234029AbhHIImC (ORCPT + 99 others); Mon, 9 Aug 2021 04:42:02 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:36788 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233933AbhHIImB (ORCPT ); Mon, 9 Aug 2021 04:42:01 -0400 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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