Re: [PATCH -v5 0/9] migrate_pages(): batch TLB flushing

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

 



On Mon, Feb 20, 2023 at 06:48:38PM -0800, Hugh Dickins wrote:
> Yes, that's a good principle, that we should avoid to lock/wait
> synchronously once we have locked one folio (hmm, above you say
> "more than one": I think we mean the same thing, we're just
> stating it differently, given how the code runs at present).

I suspect the migrate page code is disobeying the locking ordering
rules for multiple folios.  if two folios belong to the same file,
they must be locked by folio->index order, low to high.  If two folios
belong to different files, they must be ordered by folio->mapping, the
mapping lowest in memory first.  You can see this locking rule embedded
in vfs_lock_two_folios() in fs/remap_range.c.

I don't know what the locking rules are for two folios which are not file
folios, or for two folios when one is anonymous and the other belongs
to a file.  Maybe it's the same; you can lock them ordered by ->mapping
first, then by ->index.

Or you can just trylock multiple folios and skip the ones that don't work.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux