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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDFB4C77B78 for ; Tue, 2 May 2023 20:20:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229990AbjEBUUY (ORCPT ); Tue, 2 May 2023 16:20:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbjEBUUX (ORCPT ); Tue, 2 May 2023 16:20:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1B41198C for ; Tue, 2 May 2023 13:20:22 -0700 (PDT) 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 7296961EC7 for ; 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 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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.