Re: [PATCH v3] mm/huge_memory: unlock i_mmap_rwsem before releasing after-split folios

From: Kairui Song

Date: Mon Jul 20 2026 - 00:35:55 EST


On Mon, Jul 20, 2026 at 04:34:37AM +0800, Matthew Wilcox wrote:
> On Fri, Jul 17, 2026 at 07:58:51PM -0700, Andrew Morton wrote:
> > (why is mapping_set_update() a) a macro and b) undocumented?)
>
> commit 62e72d2cf702
>
> So make madvise(..., MADV_COLLAPSE) also call xas_set_lru() to pass the
> list_lru which we may want to insert xa_node into later. And move
> mapping_set_update to mm/internal.h, and turn into a macro to avoid
> including extra headers in mm/internal.h.
>
> Take it up with Kairui. And whoever it was added that patch to
> linux-mm.

Right, I initially wanted to make it a inline helper, since this function
were a macro and later become a static helper, so it should be super cheap
in the hot path. That requires to include extra headers in internal.h
and that looked a bit more uglier and every internel.h user will have
extra header dependency. Moving it to pagemap.h also looked confusing
along size other mapping_set_* helper, they are completely different
things, and this help should stay in mm/.

So I just partially restored how it was before b64e74e95aa6, It was
never documented though.

We can make it a function for sure, open to suggestions on this.