lkml.org 
[lkml]   [2023]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] mm/khugepaged: set THP as uptodate earlier for shmem
On Tue, Feb 14, 2023 at 04:57:09PM +0900, David Stevens wrote:
> /*
> - * At this point the hpage is locked and not up-to-date.
> - * It's safe to insert it into the page cache, because nobody would
> - * be able to map it or use it in another way until we unlock it.
> + * Mark hpage as up-to-date before inserting it into the page cache to
> + * prevent it from being mistaken for an fallocated but unwritten page.
> + * Inserting the unfinished hpage into the page cache is safe because
> + * it is locked, so nobody can map it or use it in another way until we
> + * unlock it.

No, that's not true. The data has to be there before we mark it
uptodate. See filemap_get_pages() for example, used as part of
read(). We don't lock the page unless we need to bring it uptodate
ourselves.

\
 
 \ /
  Last update: 2023-03-27 00:23    [W:0.122 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site