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 76E96C48BE6 for ; Wed, 16 Jun 2021 16:14:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DF57861164 for ; Wed, 16 Jun 2021 16:14:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF57861164 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 66A466B0036; Wed, 16 Jun 2021 12:14:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 607B66B006E; Wed, 16 Jun 2021 12:14:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F74E6B0070; Wed, 16 Jun 2021 12:14:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id 203636B0036 for ; Wed, 16 Jun 2021 12:14:52 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B0A9B180AD807 for ; Wed, 16 Jun 2021 16:14:51 +0000 (UTC) X-FDA: 78260085582.15.982F963 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id 316268019377 for ; Wed, 16 Jun 2021 16:14:40 +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:To:From:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=UYgA6mhHKU9oeMzNXSF0VSiZSgYXxS5DH1D4fnF0pG8=; b=vqB3tzg46j8/37tBCf9piyoUIa q6XMZHfiyFA7RruP1A6BnJZKnMM48MojXpQUuME5QEeRbj0Nydxt8wDiuLXQsXfcnjRyWxwSlJFBH 7ucNtOJ25H1OR+WBZN4Lw46euVTkLe7U4yDLYJlBPCOVMRw1qxR7Bet2jlPy0yRAUntyppskTcxCr aT4q9tdbRbzPTcrbwMIr1tXUQDy1tq1uQ/DIcm7sdCcsya9yag0VUAXQHbtBUfHOOoSfkAndIsXV9 Q/kuUVVongqTiiTzNKQ9G55BTD7jU9NybS0c1uGSLY/A/48y5hc8aiFZ/iHm63c0oywP5POslfKo3 ABo+UA8w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltYBL-008F14-TZ; Wed, 16 Jun 2021 16:14:27 +0000 Date: Wed, 16 Jun 2021 17:14:23 +0100 From: Matthew Wilcox To: Christoph Hellwig , Andrew Morton , Jan Kara , Al Viro , Greg Kroah-Hartman , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] mm/writeback: Move __set_page_dirty() to core mm Message-ID: References: <20210615162342.1669332-1-willy@infradead.org> <20210615162342.1669332-2-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210615162342.1669332-2-willy@infradead.org> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 316268019377 X-Stat-Signature: 96qym11mtjdty486h4cytxcmghme4h9m Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=vqB3tzg4; dmarc=none; spf=none (imf27.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: 1623860080-317184 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, Jun 15, 2021 at 05:23:37PM +0100, Matthew Wilcox (Oracle) wrote: > -/* > - * Mark the page dirty, and set it dirty in the page cache, and mark the inode > - * dirty. > - * > - * If warn is true, then emit a warning if the page is not uptodate and has > - * not been truncated. > - * > - * The caller must hold lock_page_memcg(). > - */ Checking against my folio tree, I found a bit of extra documentation that I had added and didn't make it into this submission. Let me know if it's useful and if so I can submit it as a fixup patch: diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 73b937955cc1..2072787d9b44 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2466,7 +2466,11 @@ void account_page_cleaned(struct page *page, struct addre ss_space *mapping, * If warn is true, then emit a warning if the page is not uptodate and has * not been truncated. * - * The caller must hold lock_page_memcg(). + * The caller must hold lock_page_memcg(). Most callers have the page + * locked. A few have the page blocked from truncation through other + * means (eg zap_page_range() has it mapped and is holding the page table + * lock). This can also be called from mark_buffer_dirty(), which I + * cannot prove is always protected against truncate. */ void __set_page_dirty(struct page *page, struct address_space *mapping, int warn) ... it's a bit "notes to self", so perhaps someone can clean it up. In particular, someone who knows the buffer code better than I do can prove that mark_buffer_dirty() is always protected against truncate.