Re: [PATCH v3] migrate_pages: Avoid blocking for IO in MIGRATE_SYNC_LIGHT

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

 



On 28 Apr 2023 13:54:38 -0700 Douglas Anderson <dianders@xxxxxxxxxxxx>
> The MIGRATE_SYNC_LIGHT mode is intended to block for things that will
> finish quickly but not for things that will take a long time. Exactly
> how long is too long is not well defined, but waits of tens of
> milliseconds is likely non-ideal.
> 
> When putting a Chromebook under memory pressure (opening over 90 tabs
> on a 4GB machine) it was fairly easy to see delays waiting for some
> locks in the kcompactd code path of > 100 ms. While the laptop wasn't
> amazingly usable in this state, it was still limping along and this
> state isn't something artificial. Sometimes we simply end up with a
> lot of memory pressure.

Was kcompactd waken up for PAGE_ALLOC_COSTLY_ORDER?
> 
> Putting the same Chromebook under memory pressure while it was running
> Android apps (though not stressing them) showed a much worse result
> (NOTE: this was on a older kernel but the codepaths here are similar).
> Android apps on ChromeOS currently run from a 128K-block,
> zlib-compressed, loopback-mounted squashfs disk. If we get a page
> fault from something backed by the squashfs filesystem we could end up
> holding a folio lock while reading enough from disk to decompress 128K
> (and then decompressing it using the somewhat slow zlib algorithms).
> That reading goes through the ext4 subsystem (because it's a loopback
> mount) before eventually ending up in the block subsystem. This extra
> jaunt adds extra overhead. Without much work I could see cases where
> we ended up blocked on a folio lock for over a second. With more
> extreme memory pressure I could see up to 25 seconds.

In the same kcompactd code path above?
> 
> We considered adding a timeout in the case of MIGRATE_SYNC_LIGHT for
> the two locks that were seen to be slow [1] and that generated much
> discussion. After discussion, it was decided that we should avoid
> waiting for the two locks during MIGRATE_SYNC_LIGHT if they were being
> held for IO. We'll continue with the unbounded wait for the more full
> SYNC modes.
> 
> With this change, I couldn't see any slow waits on these locks with my
> previous testcases.

Well this is the upside after this change, but given the win, what is
the lose/cost paid? For example the changes in compact fail and success [1].

[1] https://lore.kernel.org/lkml/20230418191313.268131-1-hannes@xxxxxxxxxxx/




[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