Re: [PATCH] resource: re-factor page_is_ram()

From: David Hildenbrand
Date: Fri Jun 10 2022 - 06:24:01 EST


On 01.06.22 18:32, Vaibhav Jain wrote:
> Presently page_is_ram() relies on walk_system_ram_range() that performs a walk
> on kernel iomem resources hierarchy with a dummy callback __is_ram(). Before
> calling find_next_iomem_res(), walk_system_ram_range() does some book-keeping
> which can be avoided for page_is_ram() use-case.
>
> Hence this patch proposes to update page_is_ram() to directly call
> find_next_iomem_res() with minimal book-keeping needed.

I consider the code harder to get compared to just reusing the
more-generic and expressive walk_system_ram_range().

It somehow feels like we're duplicating the code here just to optimize
out a handful of instructions.

If it doesn't make the code easier to read (at least for me), why do we
care?

--
Thanks,

David / dhildenb