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 2113FC433EF for ; Fri, 13 May 2022 03:39:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AFE0C6B0073; Thu, 12 May 2022 23:39:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AACC46B0078; Thu, 12 May 2022 23:39:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99D2E8D0001; Thu, 12 May 2022 23:39:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8693C6B0073 for ; Thu, 12 May 2022 23:39:32 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5CE7920F7C for ; Fri, 13 May 2022 03:39:32 +0000 (UTC) X-FDA: 79459314984.13.1F09F9A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id 4E123200AE for ; Fri, 13 May 2022 03:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xN/KS6tsUiz5+LaIG0WIUxRAnt367WcotmYkKHhzHNM=; b=tpT/2MPT69c8LRFm93umO6JcR/ Olgy+ubwHWA5e95mSxgzmc8jNPN4rvCM84TUqxLd3J3JidB3EjFx2NHCfSVVo/OsoP3t5wX5Bb61k FoYc9ISXU4tCHZU0H/RnQwJ4Q1sml3x9dOE7SGqhDwT2glm5obSfHaEGFth5uNy1vF/6SaD2j5Sjz 02Ldzmwd6lex6IkvEySelFpVUiGlqzV7cKd5MWJ5Q6HPWAMRMCAr4+6g0holGZxvl6MbixcWgwZtC h6VMVBWMZME2GU+Gm/gir8p5BiWEHUYZA0FmP63MDUmNg0Gc05khIEQGTUXvX7zInmQ7XoDVdvN4Y +XtB6FTA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1npM9I-0070o3-Js; Fri, 13 May 2022 03:39:28 +0000 Date: Fri, 13 May 2022 04:39:28 +0100 From: Matthew Wilcox To: Josef Bacik Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: Freeing page flags Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: 7d9wx8gsuq11mnf3d9ezfhzw3hj8zzeh X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4E123200AE X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="tpT/2MPT"; dmarc=none; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1652413153-161536 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 Thu, May 12, 2022 at 10:41:41PM -0400, Josef Bacik wrote: > On Thu, May 12, 2022 at 09:54:59PM +0100, Matthew Wilcox wrote: > > The LWN writeup [1] on merging the MGLRU reminded me that I need to send > > out a plan for removing page flags that we can do without. > > > > 1. PG_error. It's basically useless. If the page was read successfully, > > PG_uptodate is set. If not, PG_uptodate is clear. The page cache > > doesn't use PG_error. Some filesystems do, and we need to transition > > them away from using it. > > > > What about writes? A cursory look shows we don't clear Uptodate if we fail to > write, which is correct I think. The only way to indicate we had a write error > to check later is the page error. On encountering a write error, we're supposed to call mapping_set_error(), not SetPageError(). > > 2. PG_private. This tells us whether we have anything stored at > > page->private. We can just check if page->private is NULL or not. > > No need to have this extra bit. Again, there may be some filesystems > > that are a bit wonky here, but I'm sure they're fixable. > > > > At least for Btrfs we serialize the page->private with the private_lock, so we > could probably just drop PG_private, but it's kind of nice to check first before > we have to take the spin lock. I suppose we can just do > > if (page->private) > // do lock and check thingy That's my hope! I think btrfs is already using folio_attach_private() / attach_page_private(), which makes everything easier. Some filesystems still manipulate page->private and PagePrivate by hand.