[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a96141cb-9eba-4f61-be20-0f2c0d466e05@redhat.com>
Date: Thu, 26 Jun 2025 17:42:53 -0400
From: Luiz Capitulino <luizcap@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: david@...hat.com, willy@...radead.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, lcapitulino@...il.com, shivankg@....com
Subject: Re: [PATCH 1/3] mm: introduce snapshot_page()
On 2025-06-26 17:39, Andrew Morton wrote:
> On Thu, 26 Jun 2025 14:16:51 -0400 Luiz Capitulino <luizcap@...hat.com> wrote:
>
>> This commit refactors __dump_page() into snapshot_page().
>>
>> snapshot_page() tries to take a faithful snapshot of a page and its
>> folio representation. The snapshot is returned in the struct
>> page_snapshot parameter along with additional flags that are best
>> retrieved at snapshot creation time to reduce race windows.
>>
>> This function is intended to be used by callers that need a stable
>> representation of a struct page and struct folio so that pointers
>> or page information doesn't change while working on a page.
>>
>> The idea and original implemenetation of snapshot_page() comes from
>
> tpyo!
>
>> Matthew Wilcox with suggestions for improvements from David Hildenbrand.
>> All bugs and misconceptions are mine.
>>
>> --- a/include/linux/mm.h
>> +++ b/include/linux/mm.h
>> @@ -4184,4 +4184,24 @@ static inline bool page_pool_page_is_pp(struct page *page)
>> }
>> #endif
>>
>> +#define PAGE_SNAPSHOT_FAITHFUL (1 << 0)
>> +#define PAGE_SNAPSHOT_PG_HUGE_ZERO (1 << 1)
>> +#define PAGE_SNAPSHOT_PG_FREE (1 << 2)
>> +#define PAGE_SNAPSHOT_PG_IDLE (1 << 3)
>> +
>> +struct page_snapshot {
>> + struct folio folio_snapshot;
>> + struct page page_snapshot;
>> + unsigned long pfn;
>> + unsigned long idx;
>> + unsigned long flags;
>> +};
>> +
>> +static inline bool snapshot_page_is_faithful(const struct page_snapshot *ps)
>> +{
>> + return ps->flags & 0x1;'
>
> & PAGE_SNAPSHOT_FAITHFUL?
>
>> +}
>> +
>
> All looks sane to me. Small-system people (are there any left?) might
> point out that all the new code could be under ifdef CONFIG_PROCFS?
>
> I'll skip v1, see what reviewers have to say, thanks.
Yes, no rush. And I'll fix the things you pointed out for v2 (including
ifdef CONFIG_PROCFS). Thanks for the super quick feedback.
Powered by blists - more mailing lists