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=1796228421; b=uN+4bwDG+0G132UEr+SXsgutt0tkIBbTAr3yWyHpnBFQ126lbg2/vEo3mcf3YFvOZol5 G29SWfHmX6iEZsaAoBBWMZ7vQh7SmmcWN6BmngOUdVSJAKDXyd/lIUkOPlHw0ju/hhmuK iKkDwFOeKWWBBV+jdCkDsEMM5uCYd5vW+hcSEhQ1AFewyFKhn/ZBGfRULFMC7LfrMnAAO LJBLVdaC/93oQtW6eBm2AHT1dFDlt9lUWekzWWv80PLrrexVuWcXDU3wMb1pFrf8Le+FT zID8SDJr3M2LiklwBqC4VbRwAJMmfw+8JNUBajgc7CdquNP6AL6VfB+ylk2yDhP0w+Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796228421; 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=y8m67A2C4gcYocU6c7CduqZOmgBXz6cZL1GCD0LFDp0mJRlXAyLoOTY/uirCxFQOwt8b 6AcIoC1yQO0TDTpz4xCpHGHAE0HX+88phnoYJrhv/UJxv1if1bJJY2HGcrZHI5KuJyZVV aHojyskPMy9M7ZtkNW+XnoQoHB8/tovIeE76FHeiQLHR7tKbcurCjKZCbsfp1+lBc9Ykf KnIXWPV0NrieuTFEknWa6WVej+q9ESxlR8O/iHMSiRbkYPgACd/yoVycGEYjZHAugTkE7 3YBsB1TmDhXewhsgrqY7LgY61qF42G18l9kWbLzqG2N3iFlUDJJw/J/m2hXhcM9AzsQ== 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 F0C05606A325 for ; Wed, 2 Dec 2026 16:20:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F0C05606A325 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-rt-devel@lists.linux.dev 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.