Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp544997ybt; Wed, 24 Jun 2020 05:40:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpK9o2hN83YjlfRDbhBy5IshghOAZUI/kx4GABEvJ3jcVmG2oLJ00wDOPIBCtiP8rP5k1J X-Received: by 2002:a05:6402:376:: with SMTP id s22mr25973269edw.250.1593002438258; Wed, 24 Jun 2020 05:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593002438; cv=none; d=google.com; s=arc-20160816; b=vXJUUROj38JLYw2hsLqQR84TNLML2g+UUCjhVbG8DrLWT99ndnR5lpzSZ9ganG25nI X2wKCoUeOlnr55UT6W3HgCDRfDTk0J+VeEc4vign3hQex5JLj+3/FgnSEDh52QviVjbB CRsAZx/qsuirqQ7Bu4CME4WmJeDt3bPnDNGU1KOn9vXwxB20QVURq3z7uRyufeTyVJ7w SfZldSS63FWMf26eUsKncPoX5/DQkHpTBNUIgRYg3xKv8x6/tWDXvJEcPMmzSPDY0o8v 4K2WGbNIlM8XGRagHiBwmUwD6vV2QP5WpX+BH2Ww8jlvEv+DjMmbnZuL/xQGnyrlLk5/ nxnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=O/0cdThP5fAQ+/smPXNv+odghzJr2Q1Aqw1IMd91wZA=; b=YKdEILwLprgDq5Rx2KmxH5yRgTgLwcLAFOdGYocFgfThEqYKdXLA4tGa0gA/kwaT8v Gj+WLa2TuYFJwsT5oggjeCL++2aoVtU6EEqyXnWX/+nEy0JTpiBMn5fY8ud1ZlmuIgle 2zt76AhGGRz9QTcYmg/W/+7d/DmA5nhJn/6BwM/y/GAs0sVUvmn9fTk/fiXiQl7VWjUx 8PrPBajp10HoBxCjNqKEHiJo+FLrH5+r8DdF6ECURucMPGSZ2oApVlYCRjFh8g1lF9jz 6yN8CuYewsspwAu5DJxQ5XDc/zwcooButVz6gCQeeDJCpqEJfGg4CjwXdZD1aHumObUM hN6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=T1CWLk9B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si4957617edr.336.2020.06.24.05.40.15; Wed, 24 Jun 2020 05:40:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=T1CWLk9B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390684AbgFXMjN (ORCPT + 99 others); Wed, 24 Jun 2020 08:39:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389677AbgFXMjM (ORCPT ); Wed, 24 Jun 2020 08:39:12 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCA42C061573 for ; Wed, 24 Jun 2020 05:39:12 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id l17so1587905qki.9 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=mF5wdK9K+mmhaJ98ClMMSHQE7vGwdlu753i9gNgBSLVmORo84LtKkHDX6bHF82wEqt NA5tLeoHKFbeEsj39ZJMNcYjdJiLLULaNjbhRkNekKozDaKS7Rp1kFEp+vvFTsr8Z3rO 4dirSk/HzQKebjdBw+fuiyXokydV4dP14lNfQ3KeMIEfA9LygW01pb4/7SbjGyO0QsCC u9bQtC4K9bKMy5Il8kFqW98Gutnd6Uvaw/SMudjCUilb1XFlnkgND+6hrGanqye808pL d6jmo1NuEOnVnkKN/9vY6veLpaTu1s9VwNWLDbJ75JVgcA05RjBI6MMnFISPgF8OsF1/ TLuQ== X-Gm-Message-State: AOAM532o2ig6fQcTCdaqIyQqBpbWFFBnJ0pXqrJow85H9DUzFmJCKquH yz92choa7RZJYdoRo/PTDBH8aw== 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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