[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220224071002.w3r3at3zhccwu6p6@google.com>
Date: Wed, 23 Feb 2022 23:10:02 -0800
From: Shakeel Butt <shakeelb@...gle.com>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: akpm@...ux-foundation.org, hannes@...xchg.org, mhocko@...e.com,
pmladek@...e.com, peterz@...radead.org, guro@...com,
minchan@...nel.org, timmurray@...gle.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH v3 1/1] mm: count time in drain_all_pages during direct
reclaim as memory pressure
On Wed, Feb 23, 2022 at 11:48:12AM -0800, Suren Baghdasaryan wrote:
> When page allocation in direct reclaim path fails, the system will
> make one attempt to shrink per-cpu page lists and free pages from
> high alloc reserves. Draining per-cpu pages into buddy allocator can
> be a very slow operation because it's done using workqueues and the
> task in direct reclaim waits for all of them to finish before
> proceeding. Currently this time is not accounted as psi memory stall.
> While testing mobile devices under extreme memory pressure, when
> allocations are failing during direct reclaim, we notices that psi
> events which would be expected in such conditions were not triggered.
> After profiling these cases it was determined that the reason for
> missing psi events was that a big chunk of time spent in direct
> reclaim is not accounted as memory stall, therefore psi would not
> reach the levels at which an event is generated. Further investigation
> revealed that the bulk of that unaccounted time was spent inside
> drain_all_pages call.
> A typical captured case when drain_all_pages path gets activated:
> __alloc_pages_slowpath took 44.644.613ns
> __perform_reclaim took 751.668ns (1.7%)
> drain_all_pages took 43.887.167ns (98.3%)
> PSI in this case records the time spent in __perform_reclaim but
> ignores drain_all_pages, IOW it misses 98.3% of the time spent in
> __alloc_pages_slowpath.
> Annotate __alloc_pages_direct_reclaim in its entirety so that delays
> from handling page allocation failure in the direct reclaim path are
> accounted as memory stall.
> Reported-by: Tim Murray <timmurray@...gle.com>
> Signed-off-by: Suren Baghdasaryan <surenb@...gle.com>
> Acked-by: Johannes Weiner <hannes@...xchg.org>
Reviewed-by: Shakeel Butt <shakeelb@...gle.com>
Powered by blists - more mailing lists