From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AA7A377004 for ; Tue, 23 Jun 2026 10:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782210301; cv=none; b=Y5R9d4P0LN3GZXjitmi2R6m1/oSXH9buq2cMIelBEtDRJ0jzed1Pqt0Ijwaea4N6YDkwYxvODVMzAbwx0/J99lE4HIm6edHmRAQJIyPn6M4OxpKeRMUHoC2Ub//2o1ve8zNTChovhc5ND02Nk905p+heaOe+gNhWLQILU7yN1YY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782210301; c=relaxed/simple; bh=2bLuCZFS5AIV49JzaZGOMxvIrS4BHHMfVW8bp4M2uog=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RTc94K+BAfu982tU6tYTIzEi576DF3lBMkvLwPUagtUZAqIHZIw1r9mHFc6BAbwj44pFEK78IHZZSOSey8/1bNXGaAezQhEkqZ3qSKrLAodWW4FwJzZliuHHgckGwmZbjWgeFjMMDpDaecGBVPh7JMb5ycbTOx4NmBNp35WIaPg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KsK/oHa2; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KsK/oHa2" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-37d7c265ca5so2142411a91.2 for ; Tue, 23 Jun 2026 03:24:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782210298; x=1782815098; darn=vger.kernel.org; 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=MN3pPDGcF8EmJYIIls8L0QT+n17wsCPpidJtsIu7n1Q=; b=KsK/oHa2yvlGRGpfp/TLNSwO2rkYuzSQrYx9BozxKQu78SPpRtwv5cf2iaP1WGxPy2 RjyzM6ohk0ty91PWcCow3zPeu3cr3gYpl7OCReIN3qPvYTg977rIy8J4jPeFmXj4b7hu knUbFKKDvmhYMAzIbgFDcHw6B6lK20IIL+xxZPwVubcQamy4NKQJQNonNPApxcd7qoWY 5sIaTsSybd36LQaC8RtJmO8aJ8mKPH/+JkdURjpTVT4sAqZNPSD7/5OaJX9H5rxOvyL9 7+ElHybjeThCN+kVOQlnB7zCLFtEkrDM8gN0AA1DKZ+NcaaZWqhmCeXvXfVRZHxJI/hx zUqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782210298; x=1782815098; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MN3pPDGcF8EmJYIIls8L0QT+n17wsCPpidJtsIu7n1Q=; b=h6STInypuNBLAIB2RuL44NV5B2gxMCf132ER6xrUt6fBuJbC7/q1jIwXmZlEC2Qac4 Aen46TVc4ucl4jvmHxuHW611w2SlbcWKcB0ZqdNZK9Ts6depXJfh5yhxcuFOOWXzk4jw 6wNGUkIolH28ksNAyaiNbVcIk5q5DnRwrRtOZzM54wv/+uQT8XJvxugbzUrqbNg4+xWJ B5xWetEANYx2lAzkQXQ5qKNGidKP8DjSphp2xjItGAJ/m1j0K7N/phKNbUjAmewQcAos TcyDo0IqwcJal4os2hZ6tlHwfFBZxkoIcnp+Tbl6xv2fUQsRMLS16lYYb+DkJwma2OYT ONgw== X-Forwarded-Encrypted: i=1; AHgh+RpfrYpP2iaV61yN6tQPNTuVyJwk6Csc0UAdJTaIDOj9HLZcrxg2Kp6WbhmbkUQM6nj4KpAzgwZNCUayg00=@vger.kernel.org X-Gm-Message-State: AOJu0YweGaOVQaizBWCBpDsda3pSGlmng4Vl2JH56XFUSnm4hFJIMpPI Bh9xo5lYCrxybo3VrpdR6ByHqtzTiPnhvEd7v6JZNNdV7F+1vfDHDE5g X-Gm-Gg: AfdE7ckUZhHDVmtA/+9opyguESpouwSFnnSSY3Vg6S+Y63x+icQ9bvtpNLNXaSAs3od Y+lTYMuQ6TKKq5jjkNGk8NFdxcYEvTGZtPco0738g+6FuBtTYz4KqeSuCMSfnGarFom1ZhyYDW2 6a5pSR0iPZBAsE6EL6miA5BNqYtNTXP+7+kQks6YfJ63klw5bjZJPnOgKHAZRzy4Bw14+amPdS8 VONls662SyN2bAujIC/CqV/USV0QHuH/ye/Y/vyOV6w3ed8nXHKEijtRUz15l7OSWIbZV3d5XLZ +hbAYqRKKU7JGF8cc8fER7XKz1F8a//waHH33x3owGxthDE6cnDjNCNQij2SIzggIXKCd9t5016 rvy83w5ApMzyIXlRQIaoCSxkd61uFZP6SZTO8oZfUJvS7MTLmeLQbLb5P5fVKS0ndfpJ1Qyp3NN fUWKtYf6vrUJpeDwSwblQumimezJ9ttGhufYJsnHB6pb3CmhA0l6oY27gwwWV6ZMv/k+ehT/0hY VSE5V+/2Lrmdpkx86gVx/3EZvkfXlCC/BK9dkbXFXcLo8AFMw== X-Received: by 2002:a17:903:22c5:b0:2ba:4ad9:70f6 with SMTP id d9443c01a7336-2c718f953c5mr188846435ad.31.1782210298472; Tue, 23 Jun 2026 03:24:58 -0700 (PDT) Received: from localhost.localdomain (ec2-54-199-123-161.ap-northeast-1.compute.amazonaws.com. [54.199.123.161]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c7436ee37csm103161525ad.26.2026.06.23.03.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2026 03:24:57 -0700 (PDT) From: Xiaobo Liu To: rust-for-linux@vger.kernel.org Cc: ojeda@kernel.org, miguel.ojeda.sandonis@gmail.com, akpm@linux-foundation.org, david@fromorbit.com, qi.zheng@linux.dev, roman.gushchin@linux.dev, muchun.song@linux.dev, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Xiaobo Liu Subject: [PATCH v2] rust: helpers: move list_lru and task_work helpers out of binder.c Date: Tue, 23 Jun 2026 18:24:31 +0800 Message-Id: <20260623102431.3577627-1-cppcoffee@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The helpers in binder.c wrap generic list_lru and task_work inline functions and have nothing to do with binder. Move each of them to a file named after its own C header: - list_lru helpers move to list_lru.c, - init_task_work moves to task_work.c. Add the new list_lru.c to the SHRINKER entry in MAINTAINERS, which already covers include/linux/list_lru.h. Signed-off-by: Xiaobo Liu --- MAINTAINERS | 1 + rust/helpers/helpers.c | 3 ++- rust/helpers/{binder.c => list_lru.c} | 7 ------- rust/helpers/task_work.c | 13 +++++++++++++ 4 files changed, 16 insertions(+), 8 deletions(-) rename rust/helpers/{binder.c => list_lru.c} (72%) create mode 100644 rust/helpers/task_work.c diff --git a/MAINTAINERS b/MAINTAINERS index ba45953bb..428992431 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -24590,6 +24590,7 @@ S: Maintained F: Documentation/admin-guide/mm/shrinker_debugfs.rst F: include/linux/list_lru.h F: include/linux/shrinker.h +F: rust/helpers/list_lru.c F: mm/list_lru.c F: mm/shrinker.c F: mm/shrinker_debug.c diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c index 998e31052..ea34101b9 100644 --- a/rust/helpers/helpers.c +++ b/rust/helpers/helpers.c @@ -43,7 +43,6 @@ #include "atomic_ext.c" #include "auxiliary.c" #include "barrier.c" -#include "binder.c" #include "bitmap.c" #include "bitops.c" #include "blk.c" @@ -69,6 +68,7 @@ #include "jump_label.c" #include "kunit.c" #include "list.c" +#include "list_lru.c" #include "maple_tree.c" #include "mm.c" #include "mutex.c" @@ -93,6 +93,7 @@ #include "string.c" #include "sync.c" #include "task.c" +#include "task_work.c" #include "time.c" #include "uaccess.c" #include "usb.c" diff --git a/rust/helpers/binder.c b/rust/helpers/list_lru.c similarity index 72% rename from rust/helpers/binder.c rename to rust/helpers/list_lru.c index a2327f1b3..3b88d1a96 100644 --- a/rust/helpers/binder.c +++ b/rust/helpers/list_lru.c @@ -5,7 +5,6 @@ */ #include -#include __rust_helper unsigned long rust_helper_list_lru_count(struct list_lru *lru) { @@ -19,9 +18,3 @@ __rust_helper unsigned long rust_helper_list_lru_walk(struct list_lru *lru, { return list_lru_walk(lru, isolate, cb_arg, nr_to_walk); } - -__rust_helper void rust_helper_init_task_work(struct callback_head *twork, - task_work_func_t func) -{ - init_task_work(twork, func); -} diff --git a/rust/helpers/task_work.c b/rust/helpers/task_work.c new file mode 100644 index 000000000..cb961cd22 --- /dev/null +++ b/rust/helpers/task_work.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * Copyright (C) 2025 Google LLC. + */ + +#include + +__rust_helper void rust_helper_init_task_work(struct callback_head *twork, + task_work_func_t func) +{ + init_task_work(twork, func); +} -- 2.34.1