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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8510C433F5 for ; Fri, 1 Oct 2021 14:52:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 650E861A40 for ; Fri, 1 Oct 2021 14:52:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 650E861A40 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 89015940114; Fri, 1 Oct 2021 10:52:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83FCF9400E4; Fri, 1 Oct 2021 10:52:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7316E940114; Fri, 1 Oct 2021 10:52:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 65E919400E4 for ; Fri, 1 Oct 2021 10:52:14 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2A8D52D380 for ; Fri, 1 Oct 2021 14:52:14 +0000 (UTC) X-FDA: 78648158988.03.B99D8E4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id A76159000716 for ; Fri, 1 Oct 2021 14:52:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633099933; h=from:from:reply-to:subject:subject: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=NSYTN0aAN3tGHA9vNvHCB7aOEx6YOmDB8klvv8KBMGc=; b=VP2A5x9ht2kDVEB5IyQovCwGjUQHyn+J+TAAefLCa/EC1hGJk1iA7XlqKl8eTFEQotI8pV kPU4Sg9wEjWQ9IYo+FjnnZ+c+q+U4DA2PHld0pgl3Ac6oDBqe1RAurqn6fUPf3TCWCF4Q/ yP6xqR6o6jCxN1EH0cac74PmXkIZpaM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-96-vb7rTdsSM7-ptcLEbY7RJA-1; Fri, 01 Oct 2021 10:52:12 -0400 X-MC-Unique: vb7rTdsSM7-ptcLEbY7RJA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D43E018125C1; Fri, 1 Oct 2021 14:52:10 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id A59815BAE0; Fri, 1 Oct 2021 14:51:57 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <97eb17f51c8fd9a89f10d9dd0bf35f1075f6b236.camel@hammerspace.com> References: <97eb17f51c8fd9a89f10d9dd0bf35f1075f6b236.camel@hammerspace.com> <163189104510.2509237.10805032055807259087.stgit@warthog.procyon.org.uk> <163189108292.2509237.12615909591150927232.stgit@warthog.procyon.org.uk> To: Trond Myklebust Cc: dhowells@redhat.com, dwysocha@redhat.com, anna.schumaker@netapp.com, Matthew Wilcox , linux-cachefs@redhat.com, linux-nfs@vger.kernel.org, linux-mm@kvack.org Subject: Can the GFP flags to releasepage() be trusted? -- was Re: [PATCH v2 3/8] nfs: Move to using the alternate fallback fscache I/O API MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <81119.1633099916.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Fri, 01 Oct 2021 15:51:56 +0100 Message-ID: <81120.1633099916@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A76159000716 X-Stat-Signature: 9g9ckntqpu5ny3rg1u43kjhhhecdypqt Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VP2A5x9h; spf=none (imf23.hostedemail.com: domain of dhowells@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1633099933-703815 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: Trond Myklebust wrote: > > > @@ -432,7 +432,12 @@ static int nfs_release_page(struct page *page, = gfp_t gfp) > > > /* If PagePrivate() is set, then the page is not freeable */ > > > if (PagePrivate(page)) > > > return 0; > > > - return nfs_fscache_release_page(page, gfp); > > > + if (PageFsCache(page)) { > > > + if (!(gfp & __GFP_DIRECT_RECLAIM) || !(gfp & __GFP_FS)) > > > + return false; > > > + wait_on_page_fscache(page); > > > + } > > > + return true; > > > } > = > I've found this generally not to be safe. The VM calls ->release_page() > from a variety of contexts, and often fails to report it correctly in > the gfp flags. That's particularly true of the stuff in mm/vmscan.c. > This is why we have the check above that vetos page removal upon > PagePrivate() being set. [Adding Willy and the mm crew to the cc list] I wonder if that matters in this case. In the worst case, we'll wait for = the page to cease being DMA'd - but we won't return true if it is. But if vmscan is generating the wrong VM flags, we should look at fixing t= hat. David