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,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 EE678C433E0 for ; Thu, 25 Jun 2020 16:32:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AA049206C3 for ; Thu, 25 Jun 2020 16:32:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FbO+5/p0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA049206C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 19DDB6B0087; Thu, 25 Jun 2020 12:32:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14E9F6B0088; Thu, 25 Jun 2020 12:32:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F31226B0089; Thu, 25 Jun 2020 12:32:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id D84C26B0087 for ; Thu, 25 Jun 2020 12:32:55 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4AF42BC245 for ; Thu, 25 Jun 2020 16:32:55 +0000 (UTC) X-FDA: 76968278310.17.horn05_030701526e4e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id D3C7318036FE5 for ; Thu, 25 Jun 2020 16:32:47 +0000 (UTC) X-HE-Tag: horn05_030701526e4e X-Filterd-Recvd-Size: 4575 Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Thu, 25 Jun 2020 16:32:47 +0000 (UTC) Received: by mail-ej1-f68.google.com with SMTP id l12so6539817ejn.10 for ; Thu, 25 Jun 2020 09:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9u1owb98wt1rgpllIsg8TqO/K5Zij7HRxC2lX5Y95rM=; b=FbO+5/p0HCLuFIg2S0AOrDg23Sy86SuXq4Dj+c6XGdH5TLqJ9GNhDQB6EJ80jsNha7 WL3Tzu4KE4o1Ev8zhRwEwqIoE+Dq7+wIquVm+oeTyIdI4PyWXkJBcxwP5jKCi6fskgb+ Y+oPtD8P6WEjFKuqMlBgw4CiF2HufhMBolAIY61YiGpfTDSDbN2DMApoB3yGNTymywy2 laqUxXpD281N9g2NLNRw9I1hwyIgKzX9gZS6NjSwAQVoCH/tvO6h7KpVXzBHi8TxfvPb tGRHEXC1ey6mvARCYX6Eg2WhxqpYGV0xPozs9A9yxArEqxmFHGLMZuuUcgE5gRxO/4+m XSQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9u1owb98wt1rgpllIsg8TqO/K5Zij7HRxC2lX5Y95rM=; b=bXshQV9HMtSAXG3UZ5LK3irtvFFHcYJunXcfxyMpZ8N2+NzZju7ggFwLe3a6bd8DaF 2RF4ZCxwUJV1e7l2wlEpkGEB7EQK9EY8Uov/Qq4sV3qM+kR9hSpHicU2rUvjpLFFJXCh yan8uEFQ0CvAYC2M8LlLNf7qfEoW38GqzBX6cqFCTju2uGG0h+KE4UIK8EQs4UD9GP+r lu6Wk/7/eDeTtXXbDOZOq+grq2jd1ePWNasvz9mbxjOSynKp+8OdnCfpz1f5k0dJD79f CZXYT0gfMNZFy5Fr0HdjYT+h7MdWVXGhsIyVjQEXEb0W5dLKiGlU47yyI3Kn1VxvItyQ cy4g== X-Gm-Message-State: AOAM531rdwYmxUVp+kZlWSo3A5xA8lJsH4N1eF4OrnMZfDG7/3MEnZ4P CiSDAPS0UAXiuLFiq6XVW9RYrhoyu80C5bC771M= X-Google-Smtp-Source: ABdhPJxCQ59rjR5ytah0ieuIxKCiuojtjkelpJ5yQw9SkARvH/ShawMVo6l3ItgeCk3XW3XYiA8pvKX6fQdv0er+1CE= X-Received: by 2002:a17:906:5496:: with SMTP id r22mr31614377ejo.449.1593102766231; Thu, 25 Jun 2020 09:32:46 -0700 (PDT) MIME-Version: 1.0 References: <20200624191417.16735-1-chris@chris-wilson.co.uk> <20200625114209.GA7703@casper.infradead.org> In-Reply-To: <20200625114209.GA7703@casper.infradead.org> From: Yang Shi Date: Thu, 25 Jun 2020 09:32:34 -0700 Message-ID: Subject: Re: [PATCH] mm: Skip opportunistic reclaim for dma pinned pages To: Matthew Wilcox Cc: Chris Wilson , Linux MM , Linux Kernel Mailing List , intel-gfx@lists.freedesktop.org, Andrew Morton , Jan Kara , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , John Hubbard , Claudio Imbrenda , "Kirill A . Shutemov" , Jason Gunthorpe Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: D3C7318036FE5 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 Thu, Jun 25, 2020 at 4:42 AM Matthew Wilcox wrote: > > 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. Sounds reasonable to me. In the earlier email I suggested skip isolate dma pinned page in scan phase, but if they are long term pinned, it seems preferred to put them on the unevictable lru IMHO. > > This overly complex lease stuff must have some reason for existing, but > I still don't get it. >