Re: [PATCH 1/2] mm/mmu_notifier: Mark up direct reclaim paths with MAYFAIL

From: Jason Gunthorpe
Date: Wed Jun 24 2020 - 08:10:57 EST


On Wed, Jun 24, 2020 at 09:02:47AM +0100, Chris Wilson wrote:
> When direct reclaim enters the shrinker and tries to reclaim pages, it
> has to opportunitically unmap them [try_to_unmap_one]. For direct
> reclaim, the calling context is unknown and may include attempts to
> unmap one page of a dma object while attempting to allocate more pages
> for that object. Pass the information along that we are inside an
> opportunistic unmap that can allow that page to remain referenced and
> mapped, and let the callback opt in to avoiding a recursive wait.

i915 should already not be holding locks shared with the notifiers
across allocations that can trigger reclaim. This is already required
to use notifiers correctly anyhow - why do we need something in the
notifiers?

I really don't like this patch, the purpose of notifiers is only to
*track changes* not to influence policy of the callers.

Jason