From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8FEDC433E1 for ; Wed, 24 Jun 2020 14:16:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6B58A20823 for ; Wed, 24 Jun 2020 14:16:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="oSZInwNu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B58A20823 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EE85E6B0006; Wed, 24 Jun 2020 10:16:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E990D6B0007; Wed, 24 Jun 2020 10:16:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAE5B6B0008; Wed, 24 Jun 2020 10:16:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0241.hostedemail.com [216.40.44.241]) by kanga.kvack.org (Postfix) with ESMTP id C2E0F6B0006 for ; Wed, 24 Jun 2020 10:16:10 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8359E80195AD for ; Wed, 24 Jun 2020 14:16:10 +0000 (UTC) X-FDA: 76964304900.21.house54_3e0c7ab26e44 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 734C018043654 for ; Wed, 24 Jun 2020 14:16:06 +0000 (UTC) X-HE-Tag: house54_3e0c7ab26e44 X-Filterd-Recvd-Size: 5202 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 14:16:05 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id z2so1764390qts.5 for ; Wed, 24 Jun 2020 07:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=XTCcXGeK3qAQaLUsGMJxhzPxremK361bquJrJgQE1cM=; b=oSZInwNusWE97EVutQIRbsJeBwslSniUVMBcKNO5NzFS7QUontuAM2vj5hBHD3405f 8/T8VTo/2qNlvZ2mO8SqIxgrFiwgjfwtdJObthz+QUT21YDapCuMiaQjzpM8i3R/K2D6 V59F28UZQKm3pQxZiiguo1/NSuA2pV2/dBPu4jpU025NhlxFAypTeOFaHZnOiBoGOzAK jYUf+43UMVm+hYo50GLy/6b7ck9nYGi8syhkkTTa6r7J+nB8DUE+Vu8XsdZDuEMQ2NZO j689EkUzQ6ZL76x4cpO85iq+iACVRyJpNLylmnZNG0BABFBIUTTrPgIc0Gf+UGbOdOy7 sNzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XTCcXGeK3qAQaLUsGMJxhzPxremK361bquJrJgQE1cM=; b=rihm6VDQS342/JsyB94gb+PgCAJrwCX78+CSzQftosZNNBvPgrdSe1+wI4OwtyG15u 85DBI66eRCdthIxLMZZuXC/ssTWBYq7wwb84gpq9Z3bEqB17nvES7rmK9p4kXwR4pygO jq5mqz+doNjp5atTTsJOx/EmFv0r24BBXh3zox3NcdN2TcdQMvmoY+KgFvBH/wjKvoEy uBxaAlNonSgovJBLanKMy/KmkARleKc1UY1SZyp/QuHsrtB4BDGQ9e4wP2pU4qSytchD MubDvJcLjQMOAJmEyniK/K0SKPD9eUom1ARDw0V5CSfrVHmuIpTHFfgoLxcSu4S4VsfQ pfUQ== X-Gm-Message-State: AOAM531he+5k5A8LYr5iG47wCoLrguQPceq/542TNBFyZn20EF4/06Sw YyRARYLeN9qlIODRw3HYbtEr3w== X-Google-Smtp-Source: ABdhPJyW2dPUM+A7yBYIrkOOv8sORMSsfevlcFmoEvCmSNNu6lYvZkMYo+cDmLcsvnM9ij/fbJQwOA== X-Received: by 2002:ac8:6f79:: with SMTP id u25mr27438038qtv.183.1593008165117; Wed, 24 Jun 2020 07:16:05 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id t9sm3479450qke.68.2020.06.24.07.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 07:16:04 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.93) (envelope-from ) id 1jo6C4-00DVi4-3z; Wed, 24 Jun 2020 11:16:04 -0300 Date: Wed, 24 Jun 2020 11:16:04 -0300 From: Jason Gunthorpe To: Chris Wilson Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, Andrew Morton Subject: Re: [PATCH 1/2] mm/mmu_notifier: Mark up direct reclaim paths with MAYFAIL Message-ID: <20200624141604.GH6578@ziepe.ca> References: <20200624080248.3701-1-chris@chris-wilson.co.uk> <20200624121053.GD6578@ziepe.ca> <159300126338.4527.3968787379471939056@build.alporthouse.com> <20200624123910.GA3178169@ziepe.ca> <159300796224.4527.2014771396582759689@build.alporthouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <159300796224.4527.2014771396582759689@build.alporthouse.com> X-Rspamd-Queue-Id: 734C018043654 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jun 24, 2020 at 03:12:42PM +0100, Chris Wilson wrote: > Quoting Jason Gunthorpe (2020-06-24 13:39:10) > > On Wed, Jun 24, 2020 at 01:21:03PM +0100, Chris Wilson wrote: > > > Quoting Jason Gunthorpe (2020-06-24 13:10:53) > > > > 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? > > > > > > for (n = 0; n < num_pages; n++) > > > pin_user_page() > > > > > > may call try_to_unmap_page from the lru shrinker for [0, n-1]. > > > > Yes, of course you can't hold any locks that intersect with notifiers > > across pin_user_page()/get_user_page() > > What lock though? It's just the page refcount, shrinker asks us to drop > it [via mmu], we reply we would like to keep using that page as freeing > it for the current allocation is "robbing Peter to pay Paul". Maybe I'm unclear what this series is actually trying to fix? You said "avoiding a recursive wait" which sounds like some locking deadlock to me. Still, again, notifiers are for tracking, not for influencing MM policy. Jason