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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,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 D3629C4338F for ; Wed, 28 Jul 2021 12:52:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7BBF560E09 for ; Wed, 28 Jul 2021 12:52:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7BBF560E09 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 145848D0002; Wed, 28 Jul 2021 08:52:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F6456B0071; Wed, 28 Jul 2021 08:52:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F26FD8D0002; Wed, 28 Jul 2021 08:52:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id D47606B0070 for ; Wed, 28 Jul 2021 08:51:50 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2289D22BF0 for ; Wed, 28 Jul 2021 12:51:45 +0000 (UTC) X-FDA: 78411983370.28.766D941 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf08.hostedemail.com (Postfix) with ESMTP id 92CA0300B54B for ; Wed, 28 Jul 2021 12:51:44 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 87E4A1FFA6; Wed, 28 Jul 2021 12:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1627476703; 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=N760nZXvzpnDdyilSPHJO7qHvhAQ/EWT5M2KTQvmNio=; b=L9ooC+Cid5z+SAxxhYycJx8a1SyFK/P4dXwd1vPVmHKHVmfUi5JgXDVje5P0uejK8KbYtF kbvnl0e4WiWdBZaOGbdJkZ1SRSCyUD00WW/dya+zf1NZu6PyoU65kvo8pa6lCW2rYQPnRs hi/24Gokpq0kZUKt+jreVX/3avsmNfs= 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 4F831A3B88; Wed, 28 Jul 2021 12:51:43 +0000 (UTC) Date: Wed, 28 Jul 2021 14:51:42 +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 v6 6/6] mm/mempolicy: unify the create() func for bind/interleave/prefer-many policies Message-ID: References: <1626077374-81682-1-git-send-email-feng.tang@intel.com> <1626077374-81682-7-git-send-email-feng.tang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1626077374-81682-7-git-send-email-feng.tang@intel.com> Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=L9ooC+Ci; spf=pass (imf08.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 92CA0300B54B X-Stat-Signature: f3p7sabh8fhcgehjhyiiwum5q9gt5649 X-HE-Tag: 1627476704-407617 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 12-07-21 16:09:34, Feng Tang wrote: > As they all do the same thing: sanity check and save nodemask info, create > one mpol_new_nodemask() to reduce redundancy. Do we really need a create() callback these days? > Signed-off-by: Feng Tang Other than that LGTM Acked-by: Michal Hocko > --- > mm/mempolicy.c | 24 ++++-------------------- > 1 file changed, 4 insertions(+), 20 deletions(-) > > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > index d90247d6a71b..e5ce5a7e8d92 100644 > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -192,7 +192,7 @@ static void mpol_relative_nodemask(nodemask_t *ret, const nodemask_t *orig, > nodes_onto(*ret, tmp, *rel); > } > > -static int mpol_new_interleave(struct mempolicy *pol, const nodemask_t *nodes) > +static int mpol_new_nodemask(struct mempolicy *pol, const nodemask_t *nodes) > { > if (nodes_empty(*nodes)) > return -EINVAL; > @@ -210,22 +210,6 @@ static int mpol_new_preferred(struct mempolicy *pol, const nodemask_t *nodes) > return 0; > } > > -static int mpol_new_preferred_many(struct mempolicy *pol, const nodemask_t *nodes) > -{ > - if (nodes_empty(*nodes)) > - return -EINVAL; > - pol->nodes = *nodes; > - return 0; > -} > - > -static int mpol_new_bind(struct mempolicy *pol, const nodemask_t *nodes) > -{ > - if (nodes_empty(*nodes)) > - return -EINVAL; > - pol->nodes = *nodes; > - return 0; > -} > - > /* > * mpol_set_nodemask is called after mpol_new() to set up the nodemask, if > * any, for the new policy. mpol_new() has already validated the nodes > @@ -405,7 +389,7 @@ static const struct mempolicy_operations mpol_ops[MPOL_MAX] = { > .rebind = mpol_rebind_default, > }, > [MPOL_INTERLEAVE] = { > - .create = mpol_new_interleave, > + .create = mpol_new_nodemask, > .rebind = mpol_rebind_nodemask, > }, > [MPOL_PREFERRED] = { > @@ -413,14 +397,14 @@ static const struct mempolicy_operations mpol_ops[MPOL_MAX] = { > .rebind = mpol_rebind_preferred, > }, > [MPOL_BIND] = { > - .create = mpol_new_bind, > + .create = mpol_new_nodemask, > .rebind = mpol_rebind_nodemask, > }, > [MPOL_LOCAL] = { > .rebind = mpol_rebind_default, > }, > [MPOL_PREFERRED_MANY] = { > - .create = mpol_new_preferred_many, > + .create = mpol_new_nodemask, > .rebind = mpol_rebind_preferred, > }, > }; > -- > 2.7.4 -- Michal Hocko SUSE Labs