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 CA37DC433DF for ; Wed, 24 Jun 2020 12:39:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8B7DC20789 for ; Wed, 24 Jun 2020 12:39:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="T1CWLk9B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B7DC20789 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 0DD1F6B0008; Wed, 24 Jun 2020 08:39:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 08E0C6B000A; Wed, 24 Jun 2020 08:39:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EBEC66B000C; Wed, 24 Jun 2020 08:39:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id D66546B0008 for ; Wed, 24 Jun 2020 08:39:13 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 41E7B180AD817 for ; Wed, 24 Jun 2020 12:39:13 +0000 (UTC) X-FDA: 76964060586.10.touch66_0a160fd26e44 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 0D4FF169F9A for ; Wed, 24 Jun 2020 12:39:13 +0000 (UTC) X-HE-Tag: touch66_0a160fd26e44 X-Filterd-Recvd-Size: 4920 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 12:39:12 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id f18so1624547qkh.1 for ; Wed, 24 Jun 2020 05:39:12 -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=O/0cdThP5fAQ+/smPXNv+odghzJr2Q1Aqw1IMd91wZA=; b=T1CWLk9BQg8bxbXVlDHiZ1HNK9aWUgDyhnwXlvf7G1lp4EM9sfXD7Q96jVRjiz4yrZ lY9Rk9EgtMdOZNia1/0n1xS5Mjy1TvArYxGBRmc0xwkGY/PrAUeLiHUHCDzap5ESq+xn je4qakoryfYVA737t+MaVGU0Oar7bLHbZmOMAbAm/JXvDJETc6f1D3NY/LWERUg9I2AV D2I4p2/CHPScP0wpsmK89qHyw43+Rk+uqjpdjydVUuL3TDulgH9u+cv45WsODs4qD1Mu s4aihH09jLgE/IZaZb8127eRoffii0+tGVlAT9cDjZ9XpFo5Gp3mAI/4yPigpo7hbbl/ WHBQ== 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=O/0cdThP5fAQ+/smPXNv+odghzJr2Q1Aqw1IMd91wZA=; b=jpIP/V6JKGcAvGJbNN/COZAqQi4mdlGeES/N6etYzOxqU6w7HGUAnnZyqgYOQKilk+ u9NO5qhysS7LI3BLWdKqWjSH8wm4arTTFW+ssulN7BoV61kUAQFp5R4sSwpzOCq3a78q /B833DaGpf5+knaxY6sE9+0I96NYEOMlp38BKdOQIQfRsMBf7e9o+cG8sYIIISQfClBp Ac50kpZRe3GdzEmHSJHm9cX9OLukyjbc3YtqdPUDbyfI3LCmCwfPZScw2glPJDC3L2Y+ WBk240Qz4+XEOBvPxmMP5A8TWEAnS5EoYCQM/In7oNw0KliXP9bzler3mOZh6fxyzhE+ o+bQ== X-Gm-Message-State: AOAM530tpms9DJZyUGhGOJqzJpfNvMoT1rK5U+7rVVQjEYItBA5M5Z8z idaLmw8a0umkWlVmFJggE4GMGQ== X-Google-Smtp-Source: ABdhPJzsppi/TSTervD1YOTkftKCwoEPTx4uYqETqOWiNzYhzo6xfHzVvPg4ru+tFHHQY6xy8smpbw== X-Received: by 2002:a37:ef08:: with SMTP id j8mr25034888qkk.442.1593002351998; Wed, 24 Jun 2020 05:39:11 -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 x19sm3587303qtc.36.2020.06.24.05.39.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 05:39:10 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.93) (envelope-from ) id 1jo4gI-00DKtq-DH; Wed, 24 Jun 2020 09:39:10 -0300 Date: Wed, 24 Jun 2020 09:39:10 -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: <20200624123910.GA3178169@ziepe.ca> References: <20200624080248.3701-1-chris@chris-wilson.co.uk> <20200624121053.GD6578@ziepe.ca> <159300126338.4527.3968787379471939056@build.alporthouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <159300126338.4527.3968787379471939056@build.alporthouse.com> X-Rspamd-Queue-Id: 0D4FF169F9A 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 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() It has always been that way. I consolidated all this tricky locking into interval notifiers, maybe updating i915 to use them will give it a solution. I looked at it once, it was straightforward enough until it got to all the #ifdefery > We're in the middle of allocating the object, how are we best to untangle > that? I don't know anything about i915, but this is clearly i915 not using notifiers properly, it needs proper fixing, not hacking up notifiers. Jason