Re: [PATCH 2/2] xfs: count folio alloc'd xfs_buf items in NR_KERNEL_MISC_RECLAIMABLE

Eric Sandeen <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,org.kvack.linux-mm
Message-ID <[email protected]>
On 8/14/26 2:25 AM, Christoph Hellwig wrote:
> On Thu, Aug 13, 2026 at 03:40:53PM -0500, Eric Sandeen wrote:
>> xfs_buf allocations via xfs_buf_alloc_folio are actually reclaimable,
>> but are not accounted for as such. NR_KERNEL_MISC_RECLAIMABLE seems
>> made for this purpose, although AFAICT there are no users today.
>>
>> To achieve this, add a new flag _XBF_PAGES to track what we have
>> allocated this way, increment the NR_KERNEL_MISC_RECLAIMABLE
>> count when we do, and then do the reverse when they are freed.
> 
> I don't see why we'd need the flag.  All buffers are either allocated
> using vmalloc, kmalloc or as folios.  So it should always be set for
> folio allocations (and is misnamed since it now covers folios as well).

Hmm ok I think you're right. And using PAGES is misnamed, yeah.
>>
>> These allocations now show up under nr_kernel_misc_reclaimable in
>> /proc/vmstat when allocations are active, which in turn makes
>> MemAvailable more accurate in /proc/meminfo.
> 
> Adding linux-mm and a few people that touched this counter for
> opinions.  I guess the counter is only for full folios, and we
> should not set it for the small than page kmalloc allocations?
> But even with that, why not set it for the vmalloc allocations?
I hesitated based on node accounting but dchinner sounded unconcerned:
"If it gets accounted to the node of the first folio,
then it will at least always be consistently accounted, if not
always 100% accurate for the vmalloc case."

I fixed those up but won't resend just yet, thanks.

And I promise to use more columns next time ;)

-Eric
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.