On Tue, Dec 6, 2022 at 9:14 AM Johannes Weiner <hannes@xxxxxxxxxxx> wrote: > > During charge moving, the pte lock and the page lock cover nearly all > cases of stabilizing page_mapped(). The only exception is when we're > looking at a non-present pte and find a page in the page cache or in > the swapcache: if the page is mapped elsewhere, it can become unmapped > outside of our control. For this reason, rmap needs lock_page_memcg(). > > We don't like cgroup-specific locks in generic MM code - especially in > performance-critical MM code - and for a legacy feature that's > unlikely to have many users left - if any. > > So remove the exception. Arguably that's better semantics anyway: the > page is shared, and another process seems to be the more active user. > > Once we stop moving such pages, rmap doesn't need lock_page_memcg() > anymore. The next patch will remove it. > > Suggested-by: Hugh Dickins <hughd@xxxxxxxxxx> > Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx> Acked-by: Shakeel Butt <shakeelb@xxxxxxxxxx>