Re: Does GUP page unpinning have to be done in the pinning context?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/6/25 11:39 PM, Christoph Hellwig wrote:
> On Fri, Apr 04, 2025 at 09:59:40AM -0700, John Hubbard wrote:
>>> gup_put_folio() seems to only rely on per-folio information (esp.
>>> node_stat_mod_folio).
>>>
>>> So there should not be such a context requirement.
>>
>> That is correct. The essence of gup/pup is that it operates on
>> struct pages, and doesn't have any "moral" connection to higher
>> layers or additional process context.
> 
> Hmm, indeed.  I misremembered why the block based direct I/O code is
> doing the process context offload, which is to call set_page_dirty to
> redirty pages where the dirty bit was cleared during direct I/O.
> 
> Which I think now that all block based file systems use FOLL_PIN
> shouldn't be needed anymore, because no one can clear the dirty bit
> while the folios are pinned?
> 

No one should clear the dirty bit while the pages are pinned, agreed.

This topic always worries me, because the original problem with
dirty pages is still unfixed: setting pages dirty upon unpinning
is both widely done (last time I checked), and yet broken, because
it doesn't do a mkdirty() call to set up writeback buffers.

The solution always seemed to point toward "get a file lease on that
range, before pinning", but it's a contentious design area to say
the least.


thanks,
-- 
John Hubbard





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux