From nobody Sat Oct 4 11:13:48 2025 Received: from baidu.com (mx22.baidu.com [220.181.50.185]) (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 8786025D53B; Mon, 18 Aug 2025 03:24:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.181.50.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755487499; cv=none; b=fn19LXhN0tMPGfgJOTPea0W+CfXE4Pw4Wq67plii1sYFVTZYYcs+CBlGgR26xnwmLUoTfULiZSakY5MWivAotryBopXxKAFkuHHouYgTNgkYrooIVmbjirxXH0AqqZgDevxejwyO35lmnhwKj5862JKdFAU8W17VtlF/Grlimxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755487499; c=relaxed/simple; bh=wi2kRpnTO2A/WrOgjNo/vYLtqr3YGX7eHBKRlFB0eeE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=sasFlsPdMTWx756b8MyYax/V+lJIPovICILewmSAEJ27DIk0mI/pckaBsVSnT6CgCL9yw9+A/PP1azxv+rHeyyED3Qg89ILrgi0hMY2M5lZm9AhhaFUtA6A/4CZbQdOsEfVsoLam8NV8+2kC6FfsLMG7gbbrE8vHE617hwgf9T4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com; spf=pass smtp.mailfrom=baidu.com; arc=none smtp.client-ip=220.181.50.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baidu.com From: Fushuai Wang To: , , , , , CC: , , , , , , , , Fushuai Wang Subject: [PATCH bpf-next v2] bpf: Replace get_next_cpu() with cpumask_next_wrap() Date: Mon, 18 Aug 2025 11:23:44 +0800 Message-ID: <20250818032344.23229-1-wangfushuai@baidu.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: bjhj-exc2.internal.baidu.com (172.31.3.12) To bjhj-exc17.internal.baidu.com (172.31.4.15) X-FEAS-Client-IP: 172.31.4.15 X-FE-Policy-ID: 52:10:53:SYSTEM Content-Type: text/plain; charset="utf-8" The get_next_cpu() function was only used in one place to find the next possible CPU, which can be replaced by cpumask_next_wrap(). Signed-off-by: Fushuai Wang --- kernel/bpf/bpf_lru_list.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/kernel/bpf/bpf_lru_list.c b/kernel/bpf/bpf_lru_list.c index 2d6e1c98d8ad..e7a2fc60523f 100644 --- a/kernel/bpf/bpf_lru_list.c +++ b/kernel/bpf/bpf_lru_list.c @@ -19,14 +19,6 @@ #define LOCAL_PENDING_LIST_IDX LOCAL_LIST_IDX(BPF_LRU_LOCAL_LIST_T_PENDING) #define IS_LOCAL_LIST_TYPE(t) ((t) >=3D BPF_LOCAL_LIST_T_OFFSET) =20 -static int get_next_cpu(int cpu) -{ - cpu =3D cpumask_next(cpu, cpu_possible_mask); - if (cpu >=3D nr_cpu_ids) - cpu =3D cpumask_first(cpu_possible_mask); - return cpu; -} - /* Local list helpers */ static struct list_head *local_free_list(struct bpf_lru_locallist *loc_l) { @@ -482,7 +474,7 @@ static struct bpf_lru_node *bpf_common_lru_pop_free(str= uct bpf_lru *lru, =20 raw_spin_unlock_irqrestore(&steal_loc_l->lock, flags); =20 - steal =3D get_next_cpu(steal); + steal =3D cpumask_next_wrap(steal, cpu_possible_mask); } while (!node && steal !=3D first_steal); =20 loc_l->next_steal =3D steal; --=20 2.36.1