linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: pratyush@kernel.org, pasha.tatashin@soleen.com, rppt@kernel.org,
	dmatlack@google.com, skhawaja@google.com, rientjes@google.com,
	corbet@lwn.net, akpm@linux-foundation.org, kees@kernel.org,
	davidgow@google.com, pmladek@suse.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	nicolas.frattaroli@collabora.com, linux-doc@vger.kernel.org,
	tamird@gmail.com, raemoar63@gmail.com, graf@amazon.com
Subject: [PATCH v2 3/5] liveupdate: luo_file: Use private list
Date: Thu, 18 Dec 2025 10:57:50 -0500	[thread overview]
Message-ID: <20251218155752.3045808-4-pasha.tatashin@soleen.com> (raw)
In-Reply-To: <20251218155752.3045808-1-pasha.tatashin@soleen.com>

Switch LUO to use the private list iterators.

Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
---
 kernel/liveupdate/luo_file.c     | 7 ++++---
 kernel/liveupdate/luo_internal.h | 7 -------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c
index a32a777f6df8..1a8a1bb73a58 100644
--- a/kernel/liveupdate/luo_file.c
+++ b/kernel/liveupdate/luo_file.c
@@ -104,6 +104,7 @@
 #include <linux/io.h>
 #include <linux/kexec_handover.h>
 #include <linux/kho/abi/luo.h>
+#include <linux/list_private.h>
 #include <linux/liveupdate.h>
 #include <linux/module.h>
 #include <linux/sizes.h>
@@ -273,7 +274,7 @@ int luo_preserve_file(struct luo_file_set *file_set, u64 token, int fd)
 		goto  err_fput;
 
 	err = -ENOENT;
-	luo_list_for_each_private(fh, &luo_file_handler_list, list) {
+	list_private_for_each_entry(fh, &luo_file_handler_list, list) {
 		if (fh->ops->can_preserve(fh, file)) {
 			err = 0;
 			break;
@@ -760,7 +761,7 @@ int luo_file_deserialize(struct luo_file_set *file_set,
 		bool handler_found = false;
 		struct luo_file *luo_file;
 
-		luo_list_for_each_private(fh, &luo_file_handler_list, list) {
+		list_private_for_each_entry(fh, &luo_file_handler_list, list) {
 			if (!strcmp(fh->compatible, file_ser[i].compatible)) {
 				handler_found = true;
 				break;
@@ -835,7 +836,7 @@ int liveupdate_register_file_handler(struct liveupdate_file_handler *fh)
 		return -EBUSY;
 
 	/* Check for duplicate compatible strings */
-	luo_list_for_each_private(fh_iter, &luo_file_handler_list, list) {
+	list_private_for_each_entry(fh_iter, &luo_file_handler_list, list) {
 		if (!strcmp(fh_iter->compatible, fh->compatible)) {
 			pr_err("File handler registration failed: Compatible string '%s' already registered.\n",
 			       fh->compatible);
diff --git a/kernel/liveupdate/luo_internal.h b/kernel/liveupdate/luo_internal.h
index c8973b543d1d..3f1e0c94637e 100644
--- a/kernel/liveupdate/luo_internal.h
+++ b/kernel/liveupdate/luo_internal.h
@@ -40,13 +40,6 @@ static inline int luo_ucmd_respond(struct luo_ucmd *ucmd,
  */
 #define luo_restore_fail(__fmt, ...) panic(__fmt, ##__VA_ARGS__)
 
-/* Mimics list_for_each_entry() but for private list head entries */
-#define luo_list_for_each_private(pos, head, member)				\
-	for (struct list_head *__iter = (head)->next;				\
-	     __iter != (head) &&						\
-	     ({ pos = container_of(__iter, typeof(*(pos)), member); 1; });	\
-	     __iter = __iter->next)
-
 /**
  * struct luo_file_set - A set of files that belong to the same sessions.
  * @files_list: An ordered list of files associated with this session, it is
-- 
2.52.0.313.g674ac2bdf7-goog



  parent reply	other threads:[~2025-12-18 15:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 15:57 [PATCH v2 0/5] list private v2 & luo flb v9 Pasha Tatashin
2025-12-18 15:57 ` [PATCH v2 1/5] list: add primitives for private list manipulations Pasha Tatashin
2025-12-18 15:57 ` [PATCH v2 2/5] list: add kunit test for private list primitives Pasha Tatashin
2025-12-18 15:57 ` Pasha Tatashin [this message]
2025-12-18 15:57 ` [PATCH v9 4/5] liveupdate: luo_flb: Introduce File-Lifecycle-Bound global state Pasha Tatashin
2025-12-18 15:57 ` [PATCH v9 5/5] tests/liveupdate: Add in-kernel liveupdate test Pasha Tatashin
2025-12-18 21:07 ` [PATCH v2 0/5] list private v2 & luo flb v9 Andrew Morton
2025-12-18 22:30   ` Pasha Tatashin
2025-12-18 22:34     ` Andrew Morton
2025-12-19  6:46   ` Mike Rapoport
2025-12-19  6:53     ` Pasha Tatashin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251218155752.3045808-4-pasha.tatashin@soleen.com \
    --to=pasha.tatashin@soleen.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=davidgow@google.com \
    --cc=dmatlack@google.com \
    --cc=graf@amazon.com \
    --cc=kees@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nicolas.frattaroli@collabora.com \
    --cc=pmladek@suse.com \
    --cc=pratyush@kernel.org \
    --cc=raemoar63@gmail.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=skhawaja@google.com \
    --cc=tamird@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox