Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1377113ybt; Thu, 25 Jun 2020 04:45:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5JSqfoH+J9qFb9SEDCvlSsNDFmAK+yvhhYyPHUnmfxQ3oyaCs/MwIyduJSQPnMTsvZzFH X-Received: by 2002:a17:906:d963:: with SMTP id rp3mr17836418ejb.54.1593085526383; Thu, 25 Jun 2020 04:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593085526; cv=none; d=google.com; s=arc-20160816; b=pKbig5DsV2W8cOON8PwDv2YoBepTyc9nfWtAieKm1DMC43T5Nf8uKvj0c7zmKy8pH/ P5ewcGz9WKvm6hQqiea8PJR42fMFyyIE/HSgDW7LfPiKoTNLJQw2m5crnkCPAunLcYpF Qg065Bs5tHzGeLICu1jb5wauFIp7YTC8l+YGyDYvi13RJz3OHL2eEU7GRLFlisxKAQjL i0LCIDUigyEj7qeUThdVgGNPa/Crze/wXvH3CMSOnmZKnKz2mZlor6OPvdba97Gf7ngD xqR/wgQ+K/iXpWpv2/YuStkGovuM5yPRGdxAkex2hVFRviGobVJFnSr/3EmVKB5OHLlM Nv/Q== 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=fUle3aetxySRQYFTnbRVKd4H1XlZhjMbUYZWBlbn48k=; b=qv0QIZ83m/12W/HktapcIiDoyTZwbtU4MP42h7JxECrOC9YK7JRjd+OBei2u2Z5Y39 HY2R3i/AF8AkWXMMTQKcuRRumy5Xt9k6dLgFeY2yB+RX8bSMAACAcOFev8TPolY6f3zt do5UPwDX1LAIEVx284YD6ccdyDvOkP60xASRyY0WVLZGUMI9I8AOvoT+mROX1l4Sd43b B8tk+V83tyByxbeN7dyD4TZd9KI4CFSZmt8szQcOp68KbL9Y7yuXPgkLuJkOGu42jzvM CMXDjOZgJeJ78rx7oFrKbSP3n8VjzisBNZ6+doDsbAUh/6HQUogJqnZCw1ASHL+cJrYQ K7Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=IlAEIN73; 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 u5si15795987edq.596.2020.06.25.04.45.00; Thu, 25 Jun 2020 04:45:26 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=IlAEIN73; 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 S2404300AbgFYLmj (ORCPT + 99 others); Thu, 25 Jun 2020 07:42:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404228AbgFYLmj (ORCPT ); Thu, 25 Jun 2020 07:42:39 -0400 Received: from casper.infradead.org (unknown [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C798C061573 for ; Thu, 25 Jun 2020 04:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=fUle3aetxySRQYFTnbRVKd4H1XlZhjMbUYZWBlbn48k=; b=IlAEIN73y4SkxmCkWa7yhDlk/1 UTW+wamX8rd87nkcMA14xI0uj+0eOXBymR+brQ5VDMPdgCuIQj9fOIAD0VjGWzKJyTDEPLAij4+WQ VJJqHujQFBPr7JkgUDt+QAU0DthmowEChSj/NuZ8Hpy+1l07QSxDJFCZK6Dexf9pU6SNlVnyjs+5h yd3Qe0uKKMJzuqjIT5lWIA7tSJ01vemZ5QqyoOgreX9XHeczZitK58Q7GO1Gzdg1ykVg5Wj/BOWo+ 5GCmVrrXL7DZcbwuyEsdfVcVBmUhL5tzYpe/MMCEuWwnSPivhcofUheKgxN2SlgD9ZPx9FrKWdNb4 EBbP/zKA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1joQGf-0002Qb-OE; Thu, 25 Jun 2020 11:42:09 +0000 Date: Thu, 25 Jun 2020 12:42:09 +0100 From: Matthew Wilcox To: Chris Wilson Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, Andrew Morton , Jan Kara , =?iso-8859-1?B?Suly9G1l?= Glisse , John Hubbard , Claudio Imbrenda , "Kirill A . Shutemov" , Jason Gunthorpe Subject: Re: [PATCH] mm: Skip opportunistic reclaim for dma pinned pages Message-ID: <20200625114209.GA7703@casper.infradead.org> References: <20200624191417.16735-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624191417.16735-1-chris@chris-wilson.co.uk> 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 08:14:17PM +0100, Chris Wilson wrote: > A side effect of the LRU shrinker not being dma aware is that we will > often attempt to perform direct reclaim on the persistent group of dma > pages while continuing to use the dma HW (an issue as the HW may already > be actively waiting for the next user request), and even attempt to > reclaim a partially allocated dma object in order to satisfy pinning > the next user page for that object. > > It is to be expected that such pages are made available for reclaim at > the end of the dma operation [unpin_user_pages()], and for truly > longterm pins to be proactively recovered via device specific shrinkers > [i.e. stop the HW, allow the pages to be returned to the system, and > then compete again for the memory]. Why are DMA pinned pages still on the LRU list at all? I never got an answer to this that made sense to me. By definition, a page which is pinned for DMA is being accessed, and needs to at the very least change position on the LRU list, so just take it off the list when DMA-pinned and put it back on the list when DMA-unpinned. This overly complex lease stuff must have some reason for existing, but I still don't get it.