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.0 required=3.0 tests=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 34994C433E0 for ; Wed, 24 Jun 2020 20:24:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 04C222080C for ; Wed, 24 Jun 2020 20:24:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04C222080C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A43ED6B0025; Wed, 24 Jun 2020 16:24:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A19046B0026; Wed, 24 Jun 2020 16:24:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 956686B0027; Wed, 24 Jun 2020 16:24:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id 79A8E6B0025 for ; Wed, 24 Jun 2020 16:24:42 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3CF20181ABE88 for ; Wed, 24 Jun 2020 20:24:42 +0000 (UTC) X-FDA: 76965233604.25.note58_3113c1f26e47 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 040891804E3A9 for ; Wed, 24 Jun 2020 20:24:41 +0000 (UTC) X-HE-Tag: note58_3113c1f26e47 X-Filterd-Recvd-Size: 2999 Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 20:24:41 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 21606985-1500050 for multiple; Wed, 24 Jun 2020 21:23:58 +0100 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200624192116.GO6578@ziepe.ca> References: <20200624191417.16735-1-chris@chris-wilson.co.uk> <20200624192116.GO6578@ziepe.ca> From: Chris Wilson Subject: Re: [PATCH] mm: Skip opportunistic reclaim for dma pinned pages To: Jason Gunthorpe Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, Andrew Morton , Jan Kara , Jérôme Glisse , John Hubbard , Claudio Imbrenda , "Kirill A . Shutemov" Message-ID: <159303023309.4527.5420769464370063531@build.alporthouse.com> User-Agent: alot/0.8.1 Date: Wed, 24 Jun 2020 21:23:53 +0100 X-Rspamd-Queue-Id: 040891804E3A9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Quoting Jason Gunthorpe (2020-06-24 20:21:16) > On Wed, Jun 24, 2020 at 08:14:17PM +0100, Chris Wilson wrote: > > A general rule of thumb is that shrinkers should be fast and effective. > > They are called from direct reclaim at the most incovenient of times wh= en > > the caller is waiting for a page. If we attempt to reclaim a page being > > pinned for active dma [pin_user_pages()], we will incur far greater > > latency than a normal anonymous page mapped multiple times. Worse the > > page may be in use indefinitely by the HW and unable to be reclaimed > > in a timely manner. >=20 > A pinned page can't be migrated, discarded or swapped by definition - > it would cause data corruption. >=20 > So, how do things even get here and/or work today at all? I think the > explanation is missing something important. [<0>] userptr_mn_invalidate_range_start+0xa7/0x170 [i915] [<0>] __mmu_notifier_invalidate_range_start+0x110/0x150 [<0>] try_to_unmap_one+0x790/0x870 [<0>] rmap_walk_file+0xe9/0x230 [<0>] rmap_walk+0x27/0x30 [<0>] try_to_unmap+0x89/0xc0 [<0>] shrink_page_list+0x88a/0xf50 [<0>] shrink_inactive_list+0x137/0x2f0 [<0>] shrink_lruvec+0x4ec/0x5f0 [<0>] shrink_node+0x15d/0x410 [<0>] try_to_free_pages+0x17f/0x430 [<0>] __alloc_pages_slowpath+0x2ab/0xcc0 [<0>] __alloc_pages_nodemask+0x1ad/0x1e0 [<0>] new_slab+0x2d8/0x310 [<0>] ___slab_alloc.constprop.0+0x288/0x520 [<0>] __slab_alloc.constprop.0+0xd/0x20 [<0>] kmem_cache_alloc_trace+0x1ad/0x1c0 and that hits an active pin_user_pages object. Is there some information that would help in particular? -Chris