Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp75612lqe; Wed, 3 Apr 2024 23:13:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjK8UVzjq+Sn08CwcTYvoIxYMlNWkYWJTcodVBrAVQoP+CfV9IhKaTmZYbjywstkrogkkZuFJmUnYNSGf//8t/jTtlrZC37fj+KdmgOw== X-Google-Smtp-Source: AGHT+IEw9lJDU1qxBUc6wjiZQNHMotykeJFzTfl3axVgG/Vk+ZXuj0IAwe4v056dCjq2w1Z3vvfA X-Received: by 2002:a81:a20f:0:b0:615:4e88:c029 with SMTP id w15-20020a81a20f000000b006154e88c029mr1568897ywg.51.1712211186302; Wed, 03 Apr 2024 23:13:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712211186; cv=pass; d=google.com; s=arc-20160816; b=LFuGo4VsaVo0Zt6V43VdlNsg+VLVFXIOis0f7x1Xm2E1PPkDHNWWWRGnK/1Tqq+1kb XGpOBIo0WlSFeDD9zJyfY7Qblbj8kJNgYK35ZqGRTTLPey6kE2H0vQkjutbPFQZ0+eSx TTDxiwfw3pc1baAl84Kk9gmMGBzmnArxsF2athyVG2olGmNyfNaIPquVNJoCeTjz0AYE s18J3ytGAu+KxOBHyDK7IqaYazs+Sn5wYL+01XjvuhLCdntsqy7OzFq3t9HjTUzKPwRG wshUHPEDjJC7L7uE3Gz8D6RJwziJdjvOiDzBUvY7if8Ck0zMjTR6ZyB0V7B/53HLByWy THGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=avXvV/YgaEweVfIX+OYFhfHn6ohAwRQj390NbocEzvk=; fh=7+uXS8gtKhB/8yev3hqb1EOTIC6uuA73zR6ssdG+c9g=; b=pWDAGlkIOr0wa7U7pXXolHVgBSOSRH+woAM0Dul9AHNEUoL0gLc5WPWdT6Pm0UbDEu 7uBlgC+vHJcOxj2/2Y0Cc0r1gj0Qc8crko1jG9BuL7vz7moqdd7tUDahUkp89HYPxF2e HukJmiLPd4YeIAtg+JKy1ldldXH0esfZMiZso576ckkEpIGKhtr8FZF84ZMX+csZCk4X JrMdt/8yQSAcc64EfNPh7A8J27NgLKcAH66AnJmO7xZ4AW9PVXYfBlveSwtyWXf91ZRK s2nOdZwHxyFPoTQaqIsOUnUNK0r8TN42g/gd2hNxmMHOx2b2CzIzxKUSZi5L0aOL6rm5 ZUqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b="e/O+MMKQ"; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel+bounces-130961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=windriver.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s14-20020a63dc0e000000b005cdf89f64ffsi14939713pgg.482.2024.04.03.23.13.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:13:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b="e/O+MMKQ"; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel+bounces-130961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=windriver.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 29525B24E82 for ; Thu, 4 Apr 2024 06:00:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4520481BA; Thu, 4 Apr 2024 06:00:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="e/O+MMKQ" Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5ABC40BE6 for ; Thu, 4 Apr 2024 06:00:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.166.238 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712210402; cv=none; b=H3gD3Wzq0pKp6PNOAf8+S3cGN5gSjgjuJTeZbZ4X+TnFkB77PfbDzurGAgVlIXuZ9FbHbhA/9Gg/hHONZs2CObn+yatwRjZm/IOna8ZBZV2jxN8cwuy8wXp3jeO6I7ot/J2aL0FFXOZKE+YbB/kTbIjbi0p60n8XK0qUvsBQS90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712210402; c=relaxed/simple; bh=z9cHZ/qfKgBMB6NKxBmf35xFA5LdAxKDMWY91reJmhg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mGoHr7NWwCfpgs3aOxs3vCtKVxvdqB20F11qFJXv1DrrxFC3u2L3BbnRP1czGUfHlaIcp+/uk5zqIBF0qm2wqv95zYgS2V8QDs6vqiVlHP1HGPWZTtMScEU/dsCdThpBXGRz8gw1F/dIpNEx7ulZBEAXzmyWfIgG+s/kVL2UCyE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com; spf=pass smtp.mailfrom=windriver.com; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b=e/O+MMKQ; arc=none smtp.client-ip=205.220.166.238 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4345pec2024549; Wed, 3 Apr 2024 22:58:44 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PPS06212021; bh=avXvV/YgaEweVfIX+OYFhfHn6ohAwRQj390NbocEzvk=; b= e/O+MMKQ4iBkNhp30A38D+LdknJ4gBqYNPz8sDUWqB6Rt7Ukq5HH3fmmTXaeqOSW OQB+sARQ+ugqCvyKn17GpHsqlkSB269TWH0w8LqUddYYZUPMDZGrD3EwcRpe0zHG c0td1NXEPL/Tl2na7+mxm6qLC3a6tWz0INVuIzJHralP2JkvQvbpMnJBmGFaIGiA zG6mArk8PZpPMQOSMGcg/lpSvcENYbwOBr+hPFiQTTgQ7R+yxmsB9oWhB0+rLRru FXmHScMmWf50Bvk2IG/6ogQcxccQdW8jH1U+1QI+Rg5crZQzXxail6DXDj4Qop9x 7rU8L2+vFNNKcfCBp4pJVA== Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3x9en989ng-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 03 Apr 2024 22:58:43 -0700 (PDT) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 3 Apr 2024 22:58:43 -0700 Received: from pek-lpd-ccm5.wrs.com (147.11.1.11) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37 via Frontend Transport; Wed, 3 Apr 2024 22:58:40 -0700 From: To: , , , , , , , <42.hyeyoo@gmail.com> CC: , , Subject: [PATCH v2 2/3] mm/slub: add slub_get_cpu_partial() helper Date: Thu, 4 Apr 2024 13:58:25 +0800 Message-ID: <20240404055826.1469415-3-xiongwei.song@windriver.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240404055826.1469415-1-xiongwei.song@windriver.com> References: <20240404055826.1469415-1-xiongwei.song@windriver.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: pGdg9kS9SmD2FeZs-34uq8T6B03R4GKO X-Proofpoint-ORIG-GUID: pGdg9kS9SmD2FeZs-34uq8T6B03R4GKO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-04_02,2024-04-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 impostorscore=0 suspectscore=0 adultscore=0 malwarescore=0 mlxlogscore=929 lowpriorityscore=0 spamscore=0 phishscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404040037 From: Xiongwei Song Add slub_get_cpu_partial() and dummy function to help improve get_partial_node(). It can help remove #ifdef of CONFIG_SLUB_CPU_PARTIAL and improve filling cpu partial logic. Signed-off-by: Xiongwei Song --- mm/slub.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index 059922044a4f..590cc953895d 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -604,11 +604,21 @@ static void slub_set_cpu_partial(struct kmem_cache *s, unsigned int nr_objects) nr_slabs = DIV_ROUND_UP(nr_objects * 2, oo_objects(s->oo)); s->cpu_partial_slabs = nr_slabs; } + +static inline unsigned int slub_get_cpu_partial(struct kmem_cache *s) +{ + return s->cpu_partial_slabs; +} #else static inline void slub_set_cpu_partial(struct kmem_cache *s, unsigned int nr_objects) { } + +static inline unsigned int slub_get_cpu_partial(struct kmem_cache *s) +{ + return 0; +} #endif /* CONFIG_SLUB_CPU_PARTIAL */ /* -- 2.34.1