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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FD38C74A5B for ; Sat, 18 Mar 2023 21:30:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29FF3900003; Sat, 18 Mar 2023 17:30:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 228D3900002; Sat, 18 Mar 2023 17:30:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A396900003; Sat, 18 Mar 2023 17:30:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id EA676900002 for ; Sat, 18 Mar 2023 17:30:55 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B5F9A40D5C for ; Sat, 18 Mar 2023 21:30:55 +0000 (UTC) X-FDA: 80583314070.30.724A6E0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf20.hostedemail.com (Postfix) with ESMTP id DF3351C0016 for ; Sat, 18 Mar 2023 21:30:52 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="A/KSMpJX"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679175053; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KJ/cpwwTOsiNZoK2Zi5I+mzUQqbpVfRXw3dozXcgP1o=; b=2YaMS8jQduWn0rV8Uc/tShWVwL74xQ39Bh/vCsedNYum8k24nRUYwy46i6d0VAKL4u9TY4 aLME7+Q8z59qKmsqstXLCmfygYnthXoTS1bO006c6Q/Zdh/MPBcVfppx31GRexo+skOd4n E4scAjJhw0DRrTchRnswFvCYTnnRCLo= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="A/KSMpJX"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679175053; a=rsa-sha256; cv=none; b=EmsP7KMEoASuumnR+Ya4J6wWKV+GnJ7aZV5H2H3rq383DTryp9NCh6Eroz+1z4LLZWgMD5 S72Fs4/uGfpcLhZlk4Vm5c+jjdhGmBuMg9iagZMiRFh3GWXvvtweoM0GT6JsuScPdo/tJ+ 0wmu0BX62vJwb8md0urQRetl5FKSVO4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679175052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KJ/cpwwTOsiNZoK2Zi5I+mzUQqbpVfRXw3dozXcgP1o=; b=A/KSMpJXur74bgzITJCj64m+fz3DUHm0IvG06WS/cAHcnjBGlDozVKStXgAVZJCb4zZRVD zWDVN7sahEJjKQ2B+vWvPvKAqCBRgdhatbGENbdb4D9I/Q3okF4qlB3qeBl7JKQh35knDt muACqwjM1nDi7Y1bAgKdyC2fa6TRg7w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-270-fNv3JSNRMjKx3ATWG4qSPQ-1; Sat, 18 Mar 2023 17:30:48 -0400 X-MC-Unique: fNv3JSNRMjKx3ATWG4qSPQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 70EDD8533A2; Sat, 18 Mar 2023 21:30:47 +0000 (UTC) Received: from [10.22.8.46] (unknown [10.22.8.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0325C15BA0; Sat, 18 Mar 2023 21:30:46 +0000 (UTC) Message-ID: <2e71c2bf-9ee3-4ada-e9d9-acb6e422e9af@redhat.com> Date: Sat, 18 Mar 2023 17:30:46 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] cpuset: Clean up cpuset_node_allowed Content-Language: en-US From: Waiman Long To: Haifeng Xu Cc: lizefan.x@bytedance.com, tj@kernel.org, hannes@cmpxchg.org, akpm@linux-foundation.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <9953284e-05da-56b0-047d-ecf18aa53892@redhat.com> <20230228083537.102665-1-haifeng.xu@shopee.com> <299c9c34-0c07-ae52-61d7-6332f35c6245@redhat.com> In-Reply-To: <299c9c34-0c07-ae52-61d7-6332f35c6245@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: DF3351C0016 X-Stat-Signature: nyuu9wndm9f9cwdekuszway7r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fagE3ulrnQqrsFghC9EAKP0pxU8ixUB0aPtK3Q3+/1CNxyU30y4CjOgLjasBCBbwzHXptQpjG+hy+qQJ9eV1/liI9IBs8MrBVxKvfRmeIpQ4GFVPIA6IaX0Hxwe7NuICVxfM4V5kxN1Ra6nyjpL2GFb6xFGr6gqzEzbDG8mTCamR+Vc2VEFHDNvFxDcd0eAYLjiCAIlkOMpujriC2mE0msnZa3k8PW5htrYZ50LAY7Vxp2lrMjkNlMwUf0jQhrKxxQ== 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 3/17/23 21:35, Waiman Long wrote: > On 2/28/23 03:35, Haifeng Xu wrote: >> Commit 002f290627c2 ("cpuset: use static key better and convert to >> new API") >> has used __cpuset_node_allowed() instead of cpuset_node_allowed() to >> check >> whether we can allocate on a memory node. Now this function isn't >> used by >> anyone, so we can do the follow things to clean up it. >> >> 1. remove unused codes >> 2. rename __cpuset_node_allowed() to cpuset_node_allowed() >> 3. update comments in mm/page_alloc.c >> >> Suggested-by: Waiman Long >> Signed-off-by: Haifeng Xu >> --- >>   include/linux/cpuset.h | 16 ++-------------- >>   kernel/cgroup/cpuset.c |  4 ++-- >>   mm/page_alloc.c        |  4 ++-- >>   3 files changed, 6 insertions(+), 18 deletions(-) >> >> diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h >> index d58e0476ee8e..980b76a1237e 100644 >> --- a/include/linux/cpuset.h >> +++ b/include/linux/cpuset.h >> @@ -80,18 +80,11 @@ extern nodemask_t cpuset_mems_allowed(struct >> task_struct *p); >>   void cpuset_init_current_mems_allowed(void); >>   int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); >>   -extern bool __cpuset_node_allowed(int node, gfp_t gfp_mask); >> - >> -static inline bool cpuset_node_allowed(int node, gfp_t gfp_mask) >> -{ >> -    if (cpusets_enabled()) >> -        return __cpuset_node_allowed(node, gfp_mask); >> -    return true; >> -} >> +extern bool cpuset_node_allowed(int node, gfp_t gfp_mask); >>     static inline bool __cpuset_zone_allowed(struct zone *z, gfp_t >> gfp_mask) >>   { >> -    return __cpuset_node_allowed(zone_to_nid(z), gfp_mask); >> +    return cpuset_node_allowed(zone_to_nid(z), gfp_mask); >>   } >>     static inline bool cpuset_zone_allowed(struct zone *z, gfp_t >> gfp_mask) >> @@ -223,11 +216,6 @@ static inline int >> cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask) >>       return 1; >>   } >>   -static inline bool cpuset_node_allowed(int node, gfp_t gfp_mask) >> -{ >> -    return true; >> -} >> - > > Sorry for the late reply as I apparently drop the ball. > > You need to keep the above cpuset_node_allowed() inline function or > you will get compilation error when compiling with a config without > CONFIG_CPUSETS. Other than that, the other changes look good. > It turns out that cpuset_node_allowed() isn't used anywhere except in cpuset.h. So it should be OK to remove the alternate cpuset_node_allowed() function. Acked-by: Waiman Long