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 CBF37C64ED6 for ; Tue, 28 Feb 2023 08:36:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BC326B0071; Tue, 28 Feb 2023 03:36:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 06BE66B0072; Tue, 28 Feb 2023 03:36:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E74E76B0073; Tue, 28 Feb 2023 03:35:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D979C6B0071 for ; Tue, 28 Feb 2023 03:35:59 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A17E31A1366 for ; Tue, 28 Feb 2023 08:35:59 +0000 (UTC) X-FDA: 80516042838.18.ADBC268 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by imf27.hostedemail.com (Postfix) with ESMTP id C660440004 for ; Tue, 28 Feb 2023 08:35:57 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=shopee.com header.s=shopee.com header.b=ACFBaQ8L; spf=pass (imf27.hostedemail.com: domain of haifeng.xu@shopee.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=haifeng.xu@shopee.com; dmarc=pass (policy=reject) header.from=shopee.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677573357; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2m9p8ihrgSqCDLIO8jAiryGx9X7hvTIbRelvVFuou64=; b=ib28ORBN36U781t+tvcAB8k6/JMJuK0JGJXLx5U+DyeserJg6NAl7KOKoNthk1/30NpnDc wJYqSC4ofCb5iWfENF7Jd9frrR/1PbwQJMCGzh4s90E6nTSw5e1l9YcS4TAKDTJJqWwv7j /fREK1wM735kRFkDLkhSXKBtZ0k3sno= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=shopee.com header.s=shopee.com header.b=ACFBaQ8L; spf=pass (imf27.hostedemail.com: domain of haifeng.xu@shopee.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=haifeng.xu@shopee.com; dmarc=pass (policy=reject) header.from=shopee.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677573357; a=rsa-sha256; cv=none; b=vEXRJz5LF/e10ikK30FbrGpnBCrC8d7Oitbx2Big/1jCumoAfGlYR3yMpvSP63uy8S2nlv UrlJIhWc/xob0fZ35yzcnKnJoFdfY4H7ylXf7qmgq/RFyx2WtBNWqJnnEfGkzWlNvOo5zW tmRs47aOaX+Q9Acpvv5olEjN9kRii/g= Received: by mail-pf1-f179.google.com with SMTP id fd25so5200225pfb.1 for ; Tue, 28 Feb 2023 00:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; t=1677573356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2m9p8ihrgSqCDLIO8jAiryGx9X7hvTIbRelvVFuou64=; b=ACFBaQ8L7Rvd7Z7rTp6gb6TlTYlIHT8zfbAJbVa5AcagjWCt/hdH7FhHf0GD6crqoE l5z9Qo4ohzq6CKtz8NFnvbWScdY6X71MaG5/p8csSeWuKhQY4BGzlPfQCFhr/iuoBXTe KdMAxa3t8Pg1o9Rq+V/gS+Z8ztASY/N2CJd9YQyU6fyPt1fBeNsKL5D27po31Ulr26hV MMNcia3bHxxOLR9mLr08+5z20nDuCRI4xROWT9en3Ph2q41ETXd794o60DBDnwsMplUj 89cgOw8VNBEQT9qPIZ8E1BwDKyIfJLJAnoo4hUQk4J1IT0VikSHe9VtfV7LFDOosZo8M cc6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677573356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2m9p8ihrgSqCDLIO8jAiryGx9X7hvTIbRelvVFuou64=; b=pb0Gzg24fiHomESNvfoTb2oV6KSSiYCZ3jg7U1GG324v/+RkD0AUOCyMsZVOiWkB3a ykuiYHGtU/g1HXpwxcesk1EsVcJ1pU/jjckaCVhtqvBhDEgO/Ae52uOi15vS1B6iiYxK +r5QOF/2SMt52sdYQKogofvo1jPNxQgxXj5jQ0S5ExTlXyKirABa2VbiLrIPslvfZbab DkfT5uFRA50coNPykdT0gxQwdPzWe+OM2naAv59cDW2pjBQkpD/hbJ5EWfuccDocspr1 Oq5fYmQfdeLKIBPfejYzPdQDNu5SZgYvHMxrVdjezq4GYA/mYfEFw41ljaHQZSI8rkQ4 JCmA== X-Gm-Message-State: AO0yUKWX0X+G4S55MQVWgA2trI48hRV1og8wdn634WmCsPLuaqOD8wNM d7LtFpah6xVjl0ZjrcLZw9Fxsw== X-Google-Smtp-Source: AK7set+yFaUee4hKzhTdalVFR+do2NU6CSsr0tPR0slzongxl7jDZOFyj9n8WLELfs8JPCRnaHD2BA== X-Received: by 2002:a62:528f:0:b0:5d9:f3a6:a925 with SMTP id g137-20020a62528f000000b005d9f3a6a925mr1784980pfb.24.1677573356533; Tue, 28 Feb 2023 00:35:56 -0800 (PST) Received: from ubuntu-haifeng.default.svc.cluster.local ([101.127.248.173]) by smtp.gmail.com with ESMTPSA id bm17-20020a056a00321100b005aa80fe8be7sm5461768pfb.67.2023.02.28.00.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 00:35:56 -0800 (PST) From: Haifeng Xu To: longman@redhat.com 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, Haifeng Xu Subject: [PATCH] cpuset: Clean up cpuset_node_allowed Date: Tue, 28 Feb 2023 08:35:37 +0000 Message-Id: <20230228083537.102665-1-haifeng.xu@shopee.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <9953284e-05da-56b0-047d-ecf18aa53892@redhat.com> References: <9953284e-05da-56b0-047d-ecf18aa53892@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: es8epcsc3siqoehipt9e4oegszwm73sr X-Rspamd-Queue-Id: C660440004 X-HE-Tag: 1677573357-436510 X-HE-Meta: U2FsdGVkX1+MNDs12HJgBP8j9ssecVHRU7q843KTOVVJLYBMp1fChbr8pRhwhynDsidrdccuqLiM0ymcbkb7nyLOl0tytnzFbuY5dMTf6wN2zR80iMt0V58Zadjv/AH4lnCjQ5ES6lEH6KE1iAkvRTqITCmKfDkvVdbkl3buev6eTvbKZOSAvY0g1pmT2uPF75ostR5EsGSRjJSJi+DCuvxyL4vB2ax0Jm+o7fcQwK5XQNzOVJsQCOVTI7OmAGEjcmT/jsf48KOEW77sUgdz1pBrGGy3aUcPuh5kLWG/in5hGWE5i0Xt4YusG2QlOAQvLLj7lXLLiMMnIKfx/iwhir6oldgP4A+YmOxJ4NinFy3Ycp50dF+9zSLDeZR8yXtuZBLs2QLKZRaHeY2E4pOHqyhBc133YmgKdemvGko51JY2oEVo59Of3udfzDiXvPCNAUG68sjBUQko49r3ZC2HUelRX6NReXKSI5aVcV4Ju6jRYJw957jV5lPtk0eYq3t22sV5RUTF3MOYgk2eDmYuApBp0MQ8A9qHUxnJLOUod3nuOIbOTdAQFKvq6tIDsuwtGjxzwjC3Ly1qLbB+4zVS4xyvPSJ6iFq1UDLbFN+Vivc0JkALLFxekPeh9DtVXSaVj9vyFfoCkkxW2paxINn/2DHvAqT0tCUOIRB7k6QiAkr1O2/7Y17SSBct/OG6JbG/imqUDtJ6vwYz9VoiIqGwRWd268DpBY2yY+Yiky3xMlnbL5lbDYloZgN1wTCOn2PqvVStACH9Ms02wNCXONK8DAdiRj9M79G7COykeCy/Ap52cIM6Knt+jZIUvIHY9duBQum++eQdrI4/d1vfEUHdQoCutl8PdvMugMkGod/o8diK7Amh9F9lwqXBmiGn4J3xSohsSoADTnnb2r4HPoDv3AX+mygMwYa2IACdfiqQGpQk2nvlbpYF2WaEXM81M9UWrLRlFINUdYNAwKL0Tn4 hLPGSi5l x0FjRBwvhAb6/WQsgQ6syLER3iZdTpCW9/uyMI8je1t+pYDS+LaRnez4+IBenluQPRt8DTsHAluE+7AqFwzJMHUC2oE6qqJ9Rq5GU8STIXtGRY9trKf+jSq4Z1hiTRmPv4jS1DBTdauLOtriD2ads4N0WhdTg+T0f2vdzEwCocvGmg9Ha7AG6JlsqnSHVEx5+m77zgY3h11hhXl0EgRmZWE2b65RJl63kxAYloOXZjPM1ox3mpyGyGXnwNm0o7FMYPabmeKWqPfwiZS3THcg3ezbCp3L3THbrAA29IlxDbAUL2ioRQd54H0JtlCZrfaZ84pkUwumaQN5qapLDOlmuLHK7b2VWGItes4xjzcwpseQ0N78qtCkylfiUmNVpGXcIin9tF9dZ0zzGxtqI2X066bGY2jwkQui1iTzj8zmWmPUpl64Usk3CLnTbI782XFkzPbIUAG+u37VmdWpNIS/p6eyjRCHo1HBVFTqAO9TmV74hJ7Y= 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: 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; -} - static inline bool __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) { return true; diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 636f1c682ac0..0241b07d6f21 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3831,7 +3831,7 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs) } /* - * __cpuset_node_allowed - Can we allocate on a memory node? + * cpuset_node_allowed - Can we allocate on a memory node? * @node: is this an allowed node? * @gfp_mask: memory allocation flags * @@ -3870,7 +3870,7 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs) * GFP_KERNEL - any node in enclosing hardwalled cpuset ok * GFP_USER - only nodes in current tasks mems allowed ok. */ -bool __cpuset_node_allowed(int node, gfp_t gfp_mask) +bool cpuset_node_allowed(int node, gfp_t gfp_mask) { struct cpuset *cs; /* current cpuset ancestors */ bool allowed; /* is allocation in zone z allowed? */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3bb3484563ed..0d170ae590d8 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4175,7 +4175,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags, retry: /* * Scan zonelist, looking for a zone with enough free. - * See also __cpuset_node_allowed() comment in kernel/cgroup/cpuset.c. + * See also cpuset_node_allowed() comment in kernel/cgroup/cpuset.c. */ no_fallback = alloc_flags & ALLOC_NOFRAGMENT; z = ac->preferred_zoneref; @@ -4843,7 +4843,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask) alloc_flags |= ALLOC_HARDER; /* * Ignore cpuset mems for GFP_ATOMIC rather than fail, see the - * comment for __cpuset_node_allowed(). + * comment for cpuset_node_allowed(). */ alloc_flags &= ~ALLOC_CPUSET; } else if (unlikely(rt_task(current)) && in_task()) -- 2.25.1