Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1026527pxb; Tue, 8 Feb 2022 07:44:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcjWHpuwW/OYPV3BYJaqw687FkbX2UWEsUpdHpfQaVXy6AJaCt3uy6iMlh/UjCg0xDXqqN X-Received: by 2002:a17:906:cc54:: with SMTP id mm20mr4043609ejb.313.1644335071464; Tue, 08 Feb 2022 07:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644335071; cv=none; d=google.com; s=arc-20160816; b=tuvt6k7zbZ0H0BQuM2ur8P/3U0bpOCH5mRDiGOPE5ZsreC3k3uiwwc/UTCYKlV9d+p 0uM+N0zwHXZhUE6YCyKFSezRzHw68A7sSryNh34zi9hMyBtgEGlDsvrr8+c1MTjzrBHV bw4VTjsd11/LWwHWaK4Twt8vSLKe9H7xAlXRFDcZ7WBzJldB7FZh5b6P6eUzDhRVictz ic86fj1UlcK7kI2IR/WicIHHTqNVvv4L5f9H6WvUgjTA+ij0aqHXNPaOg7l/SlZ3TxLb LTVIDsarfJl0v1YqdYV9MEKF1tneh8xw2AD3DaEohbBE3lCIjyjU5JtO7vTVMqZPjhaF S2rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature:dkim-signature; bh=3r8zsBbPzlbUX6ihPzKY8ExxG48IN+l0THpUms1TqYM=; b=uIlZofxDFISqvPZb8ibL73OeRZok/3S6mZvk5a8dRFdDCgA5nQzq5ljlQf7kNCXa6U Xsm+ATVnvjEO8T0aOUcQb9pdH4sxr1NILhFj2imw9se+rYfBVL9P+uk3LYaNh1icUp0e sFqp4xXhMxPVFjsMlaILebuWiWtaVjW3GA9OMByvFJEsAfg7vTD+xsgtbJO6jBjVVvSa /iYedE/cIhsRfOFCpVTDbt3pBlXTX7pqZpF/cakYF7q44Jxluw0TSnUqHRCSfFnpaR/f STyOHn7ktqKAgkUqb0HlbnF2S9X9BU6SZGIGbwbxx/ZZ4tZn9wYgY8pfqwodSePHtMyb 7iyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UtZfd3bl; dkim=neutral (no key) header.i=@suse.de header.b=NUMtiBtL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t13si5758369ejf.514.2022.02.08.07.44.06; Tue, 08 Feb 2022 07:44:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=UtZfd3bl; dkim=neutral (no key) header.i=@suse.de header.b=NUMtiBtL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234246AbiBGFti (ORCPT + 99 others); Mon, 7 Feb 2022 00:49:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352029AbiBGErD (ORCPT ); Sun, 6 Feb 2022 23:47:03 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2A78C043181; Sun, 6 Feb 2022 20:47:02 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 39DA0210EA; Mon, 7 Feb 2022 04:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1644209221; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3r8zsBbPzlbUX6ihPzKY8ExxG48IN+l0THpUms1TqYM=; b=UtZfd3blxXJDljhegPqUt1T8a0XNn86n8kcT10KrYnlGH5mPQ9EbVWk9J+FFYsJoeL3hGl UD17NrMjxiyR2BQJTe+Iz7tXl4JNwmaVyVcPmskjhGF/6Siwd6+Bq9eMbymlMRm1hJDgzC YeVz/60dCfGVtNKQud3BFbvUY8iIDlY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1644209221; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3r8zsBbPzlbUX6ihPzKY8ExxG48IN+l0THpUms1TqYM=; b=NUMtiBtL6cZig7Sxd4ypS7Jn0vCqv1VQV9qag2wwmvgvOS+6PR4aq/Pz9mKtlWCmqrcSOo Axz4qktLGCHSLrDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AAA1F1330E; Mon, 7 Feb 2022 04:46:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0ALXGUGkAGIRNQAAMHmgww (envelope-from ); Mon, 07 Feb 2022 04:46:57 +0000 Subject: [PATCH 02/21] MM: drop swap_set_page_dirty From: NeilBrown To: Trond Myklebust , Anna Schumaker , Chuck Lever , Andrew Morton , Mark Hemment , Christoph Hellwig , David Howells Cc: linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Mon, 07 Feb 2022 15:46:01 +1100 Message-ID: <164420916112.29374.16921074216162707434.stgit@noble.brown> In-Reply-To: <164420889455.29374.17958998143835612560.stgit@noble.brown> References: <164420889455.29374.17958998143835612560.stgit@noble.brown> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Fixes-no-auto-backport: 62c230bc1790 ("mm: add support for a filesystem to activate swap files and use direct_IO for writing swap pages") Reviewed-by: Christoph Hellwig 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 bb38453425c7..514b86b05488 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