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 X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2B0DC433E1 for ; Tue, 23 Mar 2021 16:37:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5229D619B4 for ; Tue, 23 Mar 2021 16:37:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5229D619B4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DFEBF6B00E5; Tue, 23 Mar 2021 12:37:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAF6D6B00E9; Tue, 23 Mar 2021 12:37:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDA2D6B00EC; Tue, 23 Mar 2021 12:37:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9CB876B00E5 for ; Tue, 23 Mar 2021 12:37:31 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 64FFA9887 for ; Tue, 23 Mar 2021 16:37:31 +0000 (UTC) X-FDA: 77951694702.34.A76A4A0 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf12.hostedemail.com (Postfix) with ESMTP id 19F67796 for ; Tue, 23 Mar 2021 16:37:21 +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=b4e5o8kaGWEkrICCpRwkfXkHpFa0fxLldHksskNdA0M=; b=AxiwJgwHE38JpI/zixWsQbIi2b nb2vdPojjWnX975VXM+ABGx0ZwlNh797YAaQeXdEbWWEwJ/HiIKDD8PZxdZWtWxBIiX6FNFE2Zwvt zxA5j543dJFKsMORZDTb6oUv9oiLN5KF08iOxKI7pEEFath/xZB4IqBl1TeEe6AbjzPNYDYgEjXi7 G3aBZaODPSr+NUJM09ktAdRmgp2wKzcuaBYqPJ/7J9s8yhNK3rnXAMfNoUmvEpOtofsu2akdiBLIm Bz6YWySUMpVCzRmoLVSRSMdCNOQ9ZKf070i/anb4prcplrWptrMqTSSZtL+7eFJCHUMI3psa4KG2A PqnN/MGg==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lOk0d-00AHpR-2j; Tue, 23 Mar 2021 16:36:13 +0000 Date: Tue, 23 Mar 2021 16:35:59 +0000 From: Christoph Hellwig To: Matthew Wilcox Cc: Christoph Hellwig , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: set_page_dirty variants Message-ID: <20210323163559.GA2450855@infradead.org> References: <20210322011907.GB1719932@casper.infradead.org> <20210323154125.GA2438080@infradead.org> <20210323163027.GH1719932@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210323163027.GH1719932@casper.infradead.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 19F67796 X-Stat-Signature: 4pn5xg8xdzh5dibbbhbhikucn5ukytz6 Received-SPF: none (casper.srs.infradead.org>: No applicable sender policy available) receiver=imf12; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616517441-200606 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 Tue, Mar 23, 2021 at 04:30:27PM +0000, Matthew Wilcox wrote: > On Tue, Mar 23, 2021 at 03:41:25PM +0000, Christoph Hellwig wrote: > > On Mon, Mar 22, 2021 at 01:19:07AM +0000, Matthew Wilcox wrote: > > > I'd like to get it down to zero. After all, the !mapping case in > > > set_page_dirty() is exactly what we want. So is there a problem > > > with doing this? > > > > > > +++ b/mm/page-writeback.c > > > @@ -2562 +2562 @@ int set_page_dirty(struct page *page) > > > - if (likely(mapping)) { > > > + if (likely(mapping && mapping_can_writeback(mapping))) { > > > > > > But then I noticed that we have both mapping_can_writeback() > > > and mapping_use_writeback_tags(), and I'm no longer sure > > > which one to use. Also, why don't we mirror the results of > > > inode_to_bdi(mapping->host)->capabilities & BDI_CAP_WRITEBACK into > > > a mapping->flags & AS_something bit? > > > > Probably because no one has bothered to submit a patch yet. > > I was hoping for a little more guidance. Are mapping_can_writeback() > and mapping_use_writeback_tags() really the same thing? I mean, > obviously the swap spaces actually _can_ writeback, but it doesn't > use the tags to do it. Have you looked at the commit adding mapping_use_writeback_tags? It pretty clearly documents that as of that commit the swap cache does not use writeback tags and why.