On 1/15/26 18:45, Nikita Kalyazin wrote:


On 15/01/2026 15:55, Matthew Wilcox wrote:
On Wed, Jan 14, 2026 at 01:45:23PM +0000, Kalyazin, Nikita wrote:
+int folio_zap_direct_map(struct folio *folio)
+{
+     return set_direct_map_valid_noflush(folio_page(folio, 0),
+                                         folio_nr_pages(folio), false);
+}

The implementation isn't the greatest.  None of the implementations
of set_direct_map_valid_noflush() actually do anything with the struct
page; they all call page_address() or page_to_virt() (fundamentally the
same thing).  So converting folio->page->address is a bit inefficient.

It feels like we should change set_direct_map_valid_noflush() to take a
const void * and pass either page_address() or folio_address(), depending
whether the caller has a page or a folio.  What do you think?

I have nothing against that.  execmem_set_direct_map_valid() appears to
be the only other user of set_direct_map_valid_noflush() so it isn't
going to be a broad change.

Makes perfect sense to me :)

--
Cheers

David

Reply via email to