[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHN2nP+xPRYgMyhUEoBoqfwOQ4GZtvDjZf+B6JwoGe4xOSgf1A@mail.gmail.com>
Date: Thu, 5 Feb 2026 18:17:43 -0800
From: Jason Miu <jasonmiu@...gle.com>
To: Mike Rapoport <rppt@...nel.org>
Cc: Alexander Graf <graf@...zon.com>, Andrew Morton <akpm@...ux-foundation.org>,
Baoquan He <bhe@...hat.com>, Changyuan Lyu <changyuanl@...gle.com>,
David Matlack <dmatlack@...gle.com>, David Rientjes <rientjes@...gle.com>,
Jason Gunthorpe <jgg@...dia.com>, Pasha Tatashin <pasha.tatashin@...een.com>,
Pratyush Yadav <pratyush@...nel.org>, kexec@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v8 1/2] kho: Adopt radix tree for preserved memory tracking
Thank you so much, Mike, I've sent out the latest version.
On Tue, Feb 3, 2026 at 8:16 AM Mike Rapoport <rppt@...nel.org> wrote:
>
> On Thu, Jan 29, 2026 at 04:57:38PM -0800, Jason Miu wrote:
> > The ABI `compatible` version is bumped to "kho-v2" to reflect the
> > structural changes in the preserved memory map and sub-FDT property
> > names. This includes renaming "fdt" to "preserved-data" to better
> > reflect that preserved state may use formats other than FDT.
> >
> > Signed-off-by: Jason Miu <jasonmiu@...gle.com>
>
> With minor comments below
>
> Reviewed-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
>
> > ---
> ...
>
> > +static int __kho_radix_walk_tree(struct kho_radix_node *root,
> > + unsigned int level, unsigned long start,
> > + kho_radix_tree_walk_callback_t cb)
> > +{
> > + struct kho_radix_node *node;
> > + struct kho_radix_leaf *leaf;
> > + unsigned long key, i;
> > + unsigned int shift;
> > + int err;
> > +
> > + for (i = 0; i < PAGE_SIZE / sizeof(phys_addr_t); i++) {
> > + if (!root->table[i])
> > + continue;
> > +
> > + shift = ((level - 1) * KHO_TABLE_SIZE_LOG2) +
> > + KHO_BITMAP_SIZE_LOG2;
> > + key = start | (i << shift);
> > +
> > + node = phys_to_virt(root->table[i]);
> > +
> > + if (level == 1) {
> > + /*
> > + * we are at level 1,
> > + * node is pointing to the level 0 bitmap.
> > + */
> > + leaf = (struct kho_radix_leaf *)node;
> > + err = kho_radix_walk_leaf(leaf, key, cb);
> > + if (err)
> > + return err;
> > + } else {
> > + err = __kho_radix_walk_tree(node, level - 1,
> > + key, cb);
> > + if (err)
> > + return err;
>
> Nit: if (err) can be moved outside if (level == 1)
>
Updated.
> > + }
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +/**
> > + * kho_radix_walk_tree - Traverses the radix tree and calls a callback for each preserved page.
> > + * @tree: A pointer to the KHO radix tree to walk.
> > + * @cb: A callback function of type kho_radix_tree_walk_callback_t that will be
> > + * invoked for each preserved page found in the tree. The callback receives
> > + * the physical address and order of the preserved page.
> > + *
> > + * This function walks the radix tree, searching from the specified top level
> > + * (@level) down to the lowest level (level 0). For each preserved page found,
>
> Hmm, why do we need @level here?
> Or it rather remained from the older versions?
>
I forgot to remove this when we changed the function signature, I've
updated it as well.
Thanks again for the guidance.
>
> --
> Sincerely yours,
> Mike.
Powered by blists - more mailing lists