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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 63ADFC433DB for ; Mon, 22 Mar 2021 15:57:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E37D861984 for ; Mon, 22 Mar 2021 15:57:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E37D861984 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7752E6B00DB; Mon, 22 Mar 2021 11:38:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 725AA6B00E0; Mon, 22 Mar 2021 11:38:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59EDD6B00E2; Mon, 22 Mar 2021 11:38:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id 3767F6B00DB for ; Mon, 22 Mar 2021 11:38:50 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 997331E01 for ; Mon, 22 Mar 2021 15:57:40 +0000 (UTC) X-FDA: 77947965480.18.D532269 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf30.hostedemail.com (Postfix) with ESMTP id 0D948E037DB7 for ; Mon, 22 Mar 2021 15:57:11 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1616428630; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=943PxvuOVOvD4aIfz0aSIuAtEWSyDAhWQvjOcjR1pNk=; b=f4jLbnwVuMbmtzmw+emafC69VpgVedDhr7rg/0AcvaGfGvZxlJ5TVBfmDTPoRzGusXur9I gKwxgrQWmVdOwmX5J6jTC+zFtPRSmvMlUNAAYZPbdl5TygS/pi9TDn6CSi9HZMAqcs2crF Y5UBe3gudtxixSh7p+0W/adWm1rfAO8= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A97A5ACA8; Mon, 22 Mar 2021 15:57:10 +0000 (UTC) Date: Mon, 22 Mar 2021 16:57:05 +0100 From: Michal Hocko To: Matthew Wilcox Cc: Christian =?iso-8859-1?Q?K=F6nig?= , Dave Chinner , Leo Liu , amd-gfx list , dri-devel , Linux MM Subject: Re: [PATCH] drm/ttm: stop warning on TT shrinker failure Message-ID: References: <20210319140857.2262-1-christian.koenig@amd.com> <2831bfcc-140e-dade-1f50-a6431e495e9d@gmail.com> <1ae415c4-8e49-5183-b44d-bc92088657d5@gmail.com> <20210322140548.GN1719932@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20210322140548.GN1719932@casper.infradead.org> X-Stat-Signature: ijxp5bxisqtydrtaqr6znnitzr4tw1zt X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 0D948E037DB7 Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf30; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: invalid/invalid (public key: DNS query timeout for susede1._domainkey.suse.com at /usr/share/perl5/Mail/DKIM/DNS.pm line 152.) X-HE-Tag: 1616428631-787564 Content-Transfer-Encoding: quoted-printable 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 Mon 22-03-21 14:05:48, Matthew Wilcox wrote: > On Mon, Mar 22, 2021 at 02:49:27PM +0100, Daniel Vetter wrote: > > On Sun, Mar 21, 2021 at 03:18:28PM +0100, Christian K=F6nig wrote: > > > Am 20.03.21 um 14:17 schrieb Daniel Vetter: > > > > On Sat, Mar 20, 2021 at 10:04 AM Christian K=F6nig > > > > wrote: > > > > > Am 19.03.21 um 20:06 schrieb Daniel Vetter: > > > > > > On Fri, Mar 19, 2021 at 07:53:48PM +0100, Christian K=F6nig w= rote: > > > > > > > Am 19.03.21 um 18:52 schrieb Daniel Vetter: > > > > > > > > On Fri, Mar 19, 2021 at 03:08:57PM +0100, Christian K=F6n= ig wrote: > > > > > > > > > Don't print a warning when we fail to allocate a page f= or swapping things out. > > > > > > > > >=20 > > > > > > > > > Also rely on memalloc_nofs_save/memalloc_nofs_restore i= nstead of GFP_NOFS. > > > > > > > > Uh this part doesn't make sense. Especially since you onl= y do it for the > > > > > > > > debugfs file, not in general. Which means you've just com= pletely broken > > > > > > > > the shrinker. > > > > > > > Are you sure? My impression is that GFP_NOFS should now wor= k much more out > > > > > > > of the box with the memalloc_nofs_save()/memalloc_nofs_rest= ore(). > > > > > > Yeah, if you'd put it in the right place :-) > > > > > >=20 > > > > > > But also -mm folks are very clear that memalloc_no*() family = is for dire > > > > > > situation where there's really no other way out. For anything= where you > > > > > > know what you're doing, you really should use explicit gfp fl= ags. > > > > > My impression is just the other way around. You should try to a= void the > > > > > NOFS/NOIO flags and use the memalloc_no* approach instead. > > > > Where did you get that idea? > > >=20 > > > Well from the kernel comment on GFP_NOFS: > > >=20 > > > =A0* %GFP_NOFS will use direct reclaim but will not use any filesys= tem > > > interfaces. > > > =A0* Please try to avoid using this flag directly and instead use > > > =A0* memalloc_nofs_{save,restore} to mark the whole scope which > > > cannot/shouldn't > > > =A0* recurse into the FS layer with a short explanation why. All al= location > > > =A0* requests will inherit GFP_NOFS implicitly. > >=20 > > Huh that's interesting, since iirc Willy or Dave told me the opposite= , and > > the memalloc_no* stuff is for e.g. nfs calling into network layer (ne= eds > > GFP_NOFS) or swap on top of a filesystems (even needs GFP_NOIO I thin= k). > >=20 > > Adding them, maybe I got confused. >=20 > My impression is that the scoped API is preferred these days. >=20 > https://www.kernel.org/doc/html/latest/core-api/gfp_mask-from-fs-io.htm= l >=20 > I'd probably need to spend a few months learning the DRM subsystem to > have a more detailed opinion on whether passing GFP flags around explic= itly > or using the scope API is the better approach for your situation. yes, in an ideal world we would have a clearly defined scope of the reclaim recursion wrt FS/IO associated with it. I've got back to https://lore.kernel.org/amd-gfx/20210319140857.2262-1-christian.koenig@am= d.com/ and there are two things standing out. Why does ttm_tt_debugfs_shrink_sho= w really require NOFS semantic? And why does it play with fs_reclaim_acquire? --=20 Michal Hocko SUSE Labs