Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1669417ybt; Thu, 25 Jun 2020 11:14:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDcKehgSgxEJT9b9SYD1aSCLS7tIKkaQrPfdoeu/zO7Jlfr583Fz1mxU+J6vWi3MuObO9k X-Received: by 2002:aa7:c90a:: with SMTP id b10mr33521252edt.198.1593108867605; Thu, 25 Jun 2020 11:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593108867; cv=none; d=google.com; s=arc-20160816; b=Wtr5amQWs6NaAfdyWL+rJk/h0vUPOjleyZ95hSv45Y+qZVY9sCAMf+2v3o8w3h1nAL t07YOU6U7pej2ClrBWuqYGeyCAd1mp4GfBILgmSGeIZBA+IgoxzQQuqp7zhNDESZTDWb 5gIgrLMjiB5hMy5HJl+5eKeITzp8QrhoAs8tO5ScKUiLLH0PdwB9fxaTCrA+LB6cTxMJ aLrbEr72Tib//E5Cb76wXsOHchwCLg8MgfCdMbbIHIEl0ppfne3d/E6nQBXK43yh66JR hw6GLxVVdvvsRA9mxeu8ZEnXrruiFtsIequNUba7j4RpY+kkoVwNpJyAEgBHXxJwwnB3 ateg== 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=Nbnfe8y2phVSLNtkpgv4yoZAKzFobqvinOzyPepTciA=; b=Ryg4I6vODb3glhSxWhWoZNAHGFpn8Ys3AL1eiiAVYlSQDs5FVi7pMk0hI39K0E0Juh RNqrsZVggD1zhwD5kJ+pnM0MkxM538Z5vUnMGjWkEAHO3B2YE3V5K2A0Ld4NvJRqh0P5 TQqTVGQoX5NBsKxdQmnHp/Un7neeHkREJcGfEKSHsyo0EgrKiMuFXnIJVFXCrtbu1toE hns18XIQWaOW7x6XZ6oMOsVPffrIjV5lyDpIzC0y9R08Y0vdtICAAHzwRVqFtxXLryeX K4jjiCfTL3t6iq29niBzrIOvB9jbvr9mRgs7AarP9+ioYlVPCoV+FDki0NJzl9qikxxK Dgfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=wJ5yDwSY; 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 j27si14599861eja.627.2020.06.25.11.14.04; Thu, 25 Jun 2020 11:14:27 -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=wJ5yDwSY; 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 S2403817AbgFYQFu (ORCPT + 99 others); Thu, 25 Jun 2020 12:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389860AbgFYQFu (ORCPT ); Thu, 25 Jun 2020 12:05:50 -0400 Received: from casper.infradead.org (unknown [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A9C3C08C5C1 for ; Thu, 25 Jun 2020 09:05:50 -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=Nbnfe8y2phVSLNtkpgv4yoZAKzFobqvinOzyPepTciA=; b=wJ5yDwSYYtQBTCnxgg6LiDb+j3 OEOu0V3IhIOevYdpcK3XhbqU/M42tAf1xPjiFbpF3EbxSgs2VHixCTiGCO++8ZRo23BFZSKx8q9FT jHGhqG1fksAytQpxqYfqkDxivoCNcceeNdqpCOOAuoOxMeV3pXj5naJPPAEW7jKEnUDBfdKVxaGlp 3VLdH+Oc/oxPofZm5cEb8DT/nbQfvJjuoYXDTNQO57H+vTyksE0sJ3KebCxqFxwVsB7jcJBpBDaid RY0Br5FuDo6EhV1hJMfAsbys3Hg/Q/+WK3bQVd/iDeI7nUHdH1ekeugyVYY24yziSlHX0G3fQ4dSa mkL2JG/g==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1joUNO-0006gj-Rx; Thu, 25 Jun 2020 16:05:22 +0000 Date: Thu, 25 Jun 2020 17:05:22 +0100 From: Matthew Wilcox To: Jan Kara Cc: Chris Wilson , linux-mm@kvack.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, Andrew Morton , =?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: <20200625160522.GD7703@casper.infradead.org> References: <20200624191417.16735-1-chris@chris-wilson.co.uk> <20200625114209.GA7703@casper.infradead.org> <20200625134044.GD17788@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200625134044.GD17788@quack2.suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 25, 2020 at 03:40:44PM +0200, Jan Kara wrote: > On Thu 25-06-20 12:42:09, Matthew Wilcox wrote: > > 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. > > Well, we do mark_page_accessed() when pinning in GUP. This is not perfect > but it's as good as it gets with CPU having no control when the page is > actually accessed. Also taking the page off and then back to LRU list would > increase the contention on the LRU list locks and generally cost > performance so for short term pins it is not desirable... Otherwise I agree > that conceptually it would make some sence although I'm not sure some > places wouldn't get confused by e.g. page cache pages not being on LRU > list. We could/should do what we do for mlocked pages: Documentation/vm/unevictable-lru.rst I think 'case five' is wrong and needs to be removed. Pinning is inappropriate for "I'm going to modify the page myself".