Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1672625ybt; Thu, 25 Jun 2020 11:18:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzje0c9CcR2v0wRmcIP4z/8GcoT/3qQK575cHV1a7aCAvh00ps5xGmy5Dll6mUadgpIx+IT X-Received: by 2002:a17:906:830b:: with SMTP id j11mr32509752ejx.42.1593109116494; Thu, 25 Jun 2020 11:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593109116; cv=none; d=google.com; s=arc-20160816; b=TYiL0GTaQCKoBrKxwgh1IHvE3JccZbLvVPd+3649H70O9Ha1TTRJVZx3q6/t8k8XC7 JaXmZqRHZZSmlOp0hf9aqryQgvzdSjauhqUim/944P9lM86TeyippUKsWX+Vh3X1pLiM HmHxcBwIXaSJxoLemIPQ3zmojbC7u6GmHv5uBX7k+iyj/qdrpi1iJ/0z2r2+fq9HVRxK 0J0zuTWM4vlo4k/V21XOOnAFSP7WE89kkNOU8JSxDRMm5TYYSrDuVZsuhhy6xIkntJgE rqEw31CJ8qfM/lDBzw4qTu4CC2BASGJcxmFFGRSlD09sTfqrfS9MQ6qQ87UDLu+7u0ip dEzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9u1owb98wt1rgpllIsg8TqO/K5Zij7HRxC2lX5Y95rM=; b=PWIomsRTew/iLg8dXqytMmHlsA3XlWO2scMtLVFYvMGwUfCkRHgYXPmgSVf7NG2eLh yCB7e15YFTAT0JteOxvcpDzGwnm+ch6yxfW588+d6Ui4VfhsqMdwJ/JSyrozE8oqGqmn bvjZhtDgnCZcfXVzBVok+mqKxrRyjOoXandWh5dINHr9tGY8LjdpqrnT14LfYZ9VT6DC +oB0zBh3sMFrXPEV6dcMpmPCGfJIiSRgAahyT30uYxf5YQf1wU+EYpiZ8JOMyZtlM64S mvmxhIwOkCF+8PLPb4j7vD0oIsMn7irCKaJ+qNNAsrS0gVbVhFxJM9rb3c4pZqToV09D /P2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="FbO+5/p0"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si2433151ejl.137.2020.06.25.11.18.13; Thu, 25 Jun 2020 11:18:36 -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=@gmail.com header.s=20161025 header.b="FbO+5/p0"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390827AbgFYQcs (ORCPT + 99 others); Thu, 25 Jun 2020 12:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390007AbgFYQcr (ORCPT ); Thu, 25 Jun 2020 12:32:47 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8021AC08C5C1 for ; Thu, 25 Jun 2020 09:32:47 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id y10so6591384eje.1 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=hZUQD1D2H5BLCvGqQSOAg3hdrZyGg+OovA5hVtBEDaBQA+rIjZau8CnWWk7dHcC0PW p70Tn6pgHac7I7i4HDhFqlNjusAls0hVhOxUjo7D7Y8vUtPEGKH4CEV8Fk3LBCdZxaxv PYvrKsqx1E+ldp3BNTalBLroA+Mll4YTE+WjossIUWxfpF5XYd/FSkEF3Gp0uLw5ngrd VbgY4QMq/V2a70F9BolIvVzzO8bzp1UHqEXUI/JgC40V0+c5JEOIP7i+2qEKzQjVEv2Z qMx58xQua9+KWuTgLEUhHqO8f4HDQFICSMS0yFZHTwpPg8ClUko/pKZFmNkcrCyRM+ak aGsQ== X-Gm-Message-State: AOAM533spPpsdhVwZ5swJ0gd1nfGCE0sm/2Lqyv/hP1Y/NY35CaVtCEa 3cLL3S3ii5OGiZpSLToxYqf9XIcNK4ujK9dHyhg= 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" 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 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. >