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 029ADC433FE for ; Mon, 24 Jan 2022 07:28:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BA3B6B0081; Mon, 24 Jan 2022 02:28:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 76A6F6B0083; Mon, 24 Jan 2022 02:28:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 659B76B0085; Mon, 24 Jan 2022 02:28:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id 5977A6B0081 for ; Mon, 24 Jan 2022 02:28:35 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1155618021845 for ; Mon, 24 Jan 2022 07:28:35 +0000 (UTC) X-FDA: 79064352948.09.F601BFD Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf23.hostedemail.com (Postfix) with ESMTP id B187B140009 for ; Mon, 24 Jan 2022 07:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=YpJARcXKoGZPiJTfBdQDT9/oQ0nkzXZFh+P1EKhj/Rk=; b=1zmEJAk7pautCE8IyG6nZ+P5DN jcPS/4+RmkEGX01/KBzzlRLnv4Ujbp7wwgKrSXqfwku67x107dWyRcpSaWDJg2eGf0hDMWfsacXFb yRZJcr1xvoDHM7gKnb2AOf5U7uVKNsooqq+S+D5m1p4X/GnRmt2wP472bzUalfgBZNOewWJDqX1jH dFw11VZyBegH/EYSd1cXZwJQmpWxfT/clDdLodgbufqdxJ0oj2JFWUbRjBVSFra1KbbS8rFatUTR5 g9gxfWDSGqJhMgnekdc4tCgIhLhAZNbGLyqmIbdSqYI7fa1kbs32J9dYVoNCQULd88p/VI0M8GdoB KM8aRK3Q==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBtm5-002UAu-N6; Mon, 24 Jan 2022 07:28:25 +0000 Date: Sun, 23 Jan 2022 23:28:25 -0800 From: Christoph Hellwig To: NeilBrown Cc: Trond Myklebust , Anna Schumaker , Chuck Lever , Andrew Morton , Mel Gorman , Christoph Hellwig , David Howells , linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox Subject: Re: [PATCH 03/23] MM: drop swap_set_page_dirty Message-ID: References: <164299573337.26253.7538614611220034049.stgit@noble.brown> <164299611274.26253.3394253485576079921.stgit@noble.brown> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164299611274.26253.3394253485576079921.stgit@noble.brown> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=1zmEJAk7; dmarc=none; spf=none (imf23.hostedemail.com: domain of BATV+b18af077b488c69bdec9+6728+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+b18af077b488c69bdec9+6728+infradead.org+hch@bombadil.srs.infradead.org X-Stat-Signature: jqecf5i8onwcrxju9fs5fe4euutck5tz X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: B187B140009 X-HE-Tag: 1643009313-16938 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 Mon, Jan 24, 2022 at 02:48:32PM +1100, NeilBrown wrote: > Pages that are written to swap are owned by the MM subsystem - not any > filesystem. > > When such a page is passed to a filesystem to be written out to a > swap-file, the filesystem handles the data, but the page itself does not > belong to the filesystem. So calling the filesystem's set_page_dirty > address_space operation makes no sense. This is for pages in the given > address space, and a page to be written to swap does not exist in the > given address space. > > So drop swap_set_page_dirty() which calls the address-space's > set_page_dirty, and alway use __set_page_dirty_no_writeback, which is > appropriate for pages being swapped out. Yes, this looks sane to me: Reviewed-by: Christoph Hellwig > > Fixes-no-auto-backport: 62c230bc1790 ("mm: add support for a filesystem to activate swap files and use direct_IO for writing swap pages") > Signed-off-by: NeilBrown > --- > include/linux/swap.h | 1 - > mm/page_io.c | 14 -------------- > mm/swap_state.c | 2 +- > 3 files changed, 1 insertion(+), 16 deletions(-) > > diff --git a/include/linux/swap.h b/include/linux/swap.h > index 3f54a8941c9d..a43929f7033e 100644 > --- a/include/linux/swap.h > +++ b/include/linux/swap.h > @@ -419,7 +419,6 @@ extern void kswapd_stop(int nid); > > #ifdef CONFIG_SWAP > > -extern int swap_set_page_dirty(struct page *page); > int add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, > unsigned long nr_pages, sector_t start_block); > int generic_swapfile_activate(struct swap_info_struct *, struct file *, > diff --git a/mm/page_io.c b/mm/page_io.c > index f8c26092e869..34b12d6f94d7 100644 > --- a/mm/page_io.c > +++ b/mm/page_io.c > @@ -438,17 +438,3 @@ int swap_readpage(struct page *page, bool synchronous) > delayacct_swapin_end(); > return ret; > } > - > -int swap_set_page_dirty(struct page *page) > -{ > - struct swap_info_struct *sis = page_swap_info(page); > - > - if (data_race(sis->flags & SWP_FS_OPS)) { > - struct address_space *mapping = sis->swap_file->f_mapping; > - > - VM_BUG_ON_PAGE(!PageSwapCache(page), page); > - return mapping->a_ops->set_page_dirty(page); > - } else { > - return __set_page_dirty_no_writeback(page); > - } > -} > diff --git a/mm/swap_state.c b/mm/swap_state.c > index 093ecf864200..d541594be1c3 100644 > --- a/mm/swap_state.c > +++ b/mm/swap_state.c > @@ -31,7 +31,7 @@ > */ > static const struct address_space_operations swap_aops = { > .writepage = swap_writepage, > - .set_page_dirty = swap_set_page_dirty, > + .set_page_dirty = __set_page_dirty_no_writeback, > #ifdef CONFIG_MIGRATION > .migratepage = migrate_page, > #endif > > ---end quoted text---