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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2DCBC77B73 for ; Tue, 2 May 2023 20:20:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 44C4B6B0071; Tue, 2 May 2023 16:20:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FC706B0072; Tue, 2 May 2023 16:20:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2EB5E6B0074; Tue, 2 May 2023 16:20:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by kanga.kvack.org (Postfix) with ESMTP id 1A2D66B0071 for ; Tue, 2 May 2023 16:20:23 -0400 (EDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 72B2E621E1; Tue, 2 May 2023 20:20:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EFB2C4339B; Tue, 2 May 2023 20:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1683058821; bh=z461XssVzW/XEURncg76wDBq6FILF6Gn8ehNfF72gE8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Vz4+7uYIONcA3u9s6aR36EsZcI5nKLTNjgP9NLPPUytecC6uvHDXFPI3L9IMk7Hu9 Mui7s/cXA1ZlLPk1j25q6XZ2TDipYZBBCozcS4lh9mwP7VJ+ZtuQmKlqDaMCnKj5pR Kl/be3X1JjaxcE/424Iu/9XleaXkMmcd2exwRBJU= Date: Tue, 2 May 2023 13:20:20 -0700 From: Andrew Morton To: Jan Kara Cc: , , Lorenzo Stoakes , Christoph Hellwig , David Hildenbrand Subject: Re: [PATCH] mm: Do not reclaim private data from pinned page Message-Id: <20230502132020.5a720158307c11d5b8efe1d9@linux-foundation.org> In-Reply-To: <20230428124140.30166-1-jack@suse.cz> References: <20230428124140.30166-1-jack@suse.cz> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Fri, 28 Apr 2023 14:41:40 +0200 Jan Kara wrote: > If the page is pinned, there's no point in trying to reclaim it. > Furthermore if the page is from the page cache we don't want to reclaim > fs-private data from the page because the pinning process may be writing > to the page at any time and reclaiming fs private info on a dirty page > can upset the filesystem (see link below). Obviously I'll add a cc:stable here. I'm suspecting it's so old that there's no real Fixes: target that makes sense? > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -1901,6 +1901,16 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, > } > } > > + /* > + * Folio is unmapped now so it cannot be newly pinned anymore. > + * No point in trying to reclaim folio if it is pinned. > + * Furthermore we don't want to reclaim underlying fs metadata > + * if the folio is pinned and thus potentially modified by the > + * pinning process as that may upset the filesystem. > + */ > + if (folio_maybe_dma_pinned(folio)) > + goto activate_locked; > + So I expect the -stable maintainers will be looking for a pre-folios version of this when the time comes.