From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.95.11.211 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796228422; b=ebz77ufCzYnAelm72a/RjvlRafS3OPSywqmC2zQYgtItdSXGUOc18vztqa34Y/2e6ZRn Qv2nKW3yYnTC2KRfb1QAPbGtAgtjEilUtvMFj+IrEumzC+yld9WtKnAYSlqh7hR0Chwvq 8lQHbmQy5oR8ryrWQlXDJHBHWd29cbdqxcqRFysMRHGs6H/9ffnTIx8X5oNcc7jm2iG57 Y+FAooeDQsOQfabgJyxoCRQw2U7IRjYI4it/2Ww/mxCw+5a/6sAi9yqQAvq7N4u7iil8M 0H7tYiPW6Uyj3gLrfZxYb1SYMwM4ZNFKK9qICGmTsN78+Vp3Rg8SsB3tnoBn4fp21tQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796228422; h=DMARC-Filter:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; bh=Gs1LHaitQDcnGy9aIMHVJJW8m+8U4aWVp8lfnKrb7So=; b=DNJfivM9xWClLrV7l3cBPLgN+YJCe+XttY4BUe677MccvYp2uc8nFH7pxVaxAYi9fyQb vxg0P3slzU/RT+2yR7lrg/F6fS3UmCbP2wQKMsxbaaUxF1onmHB28ZDPHii7AKsomXDSg PKzgijW2ed2gXQIZ4TPLD5eOa4ytxdrdlFBMXSrxkfgFmdSsS2mWUmSc8MqjIAjVddItB J2s43ODGn621Q9i4hbiDYjq2MNj2s5WZPJ+JizjXuGAEWDYUxDrXoCzQAlu0kE6FIfL4E U0QIiDLiWWIjlMDQPPIsTJ6UCZunkz6Lm+XP6CxHcAmxX7uQyDGRqsuOTawhIh38avw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.remote-ip=213.95.11.211 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3583606A335; Wed, 2 Dec 2026 16:20:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B3583606A335 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id A155E68BFE; Wed, 2 Dec 2026 17:20:14 +0100 (CET) Date: Wed, 2 Dec 2026 17:20:14 +0100 From: Christoph Hellwig To: Usama Arif Cc: Andrew Morton , willy@infradead.org, jack@suse.cz, david@kernel.org, axboe@kernel.dk, Christoph Hellwig , hannes@cmpxchg.org, jlayton@kernel.org, brauner@kernel.org, tz2294@columbia.edu, ritesh.list@gmail.com, chentaotao@didiglobal.com, ziy@nvidia.com, bigeasy@linutronix.de, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, mhocko@suse.com, apopple@nvidia.com, byungchul@sk.com, gourry@gourry.net, joshua.hahnjy@gmail.com, matthew.brost@intel.com, ying.huang@linux.alibaba.com, clrkwllms@kernel.org, rostedt@goodmis.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-rt-devel@lists.linux.dev, kas@kernel.org, riel@surriel.com, shakeel.butt@linux.dev, kernel-team@meta.com, stable@vger.kernel.org Subject: Re: [PATCH 2/4] mm/filemap: clear PG_dropbehind on lookup under the folio lock Message-ID: <20261202162014.GA4653@lst.de> References: <20261202142513.2951661-1-usama.arif@linux.dev> <20261202142513.2951661-3-usama.arif@linux.dev> X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261202142513.2951661-3-usama.arif@linux.dev> User-Agent: Mutt/1.5.17 (2007-11-01) On Wed, Dec 02, 2026 at 06:24:37AM -0800, Usama Arif wrote: > + if (mapping_can_writeback(mapping)) { > struct inode *inode = mapping->host; > struct bdi_writeback *wb; > struct wb_lock_cookie cookie = {}; > - long nr = folio_nr_pages(folio); > > wb = unlocked_inode_to_wb_begin(inode, &cookie); > - wb_stat_mod(wb, WB_DONTCACHE_DIRTY, -nr); > + if (folio_test_clear_dropbehind(folio) && > + folio_test_dirty(folio)) > + wb_stat_mod(wb, WB_DONTCACHE_DIRTY, > + -folio_nr_pages(folio)); > unlocked_inode_to_wb_end(inode, &cookie); > + } else { Not urgent, but at some point it would be really nice to split this logic into a helper as it really distracts from the main logic in the function.