From patchwork Thu Jun 6 21:08:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13688960 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 A01FFC27C52 for ; Thu, 6 Jun 2024 21:08:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17A8C6B00AE; Thu, 6 Jun 2024 17:08:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12A366B00B0; Thu, 6 Jun 2024 17:08:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F33C16B00B1; Thu, 6 Jun 2024 17:08:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D576F6B00AE for ; Thu, 6 Jun 2024 17:08:48 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7977481767 for ; Thu, 6 Jun 2024 21:08:48 +0000 (UTC) X-FDA: 82201703136.06.44C3414 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf14.hostedemail.com (Postfix) with ESMTP id C6FDB100008 for ; Thu, 6 Jun 2024 21:08:46 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=mQFP4CNG; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf14.hostedemail.com: domain of 3XSViZgoKCGogWaZgIPUMLOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3XSViZgoKCGogWaZgIPUMLOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--yosryahmed.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717708126; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=Mye/YuqNKSozWj2ToP+PBiLkrDhSqJxsbKIKLkePCYI=; b=XO6m4bRU686RW95yDM5zt9t12+/81tgyAsopx8iG0cXNicVzRRKWZd6O/NDXAvvkMshnw2 W3c62t73bFW+E1mJPPvmZ0Qxo2KMnme+1YeC3sOTtlNqeQauFWDARgW3QewTEqWrlepN1Q OtMa7LqfOM7NaPwhDOItVVdfwif0hw0= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=mQFP4CNG; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf14.hostedemail.com: domain of 3XSViZgoKCGogWaZgIPUMLOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--yosryahmed.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3XSViZgoKCGogWaZgIPUMLOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--yosryahmed.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717708126; a=rsa-sha256; cv=none; b=oIFMY4wHVoLwvLkSwR/Jo/vlYONEedpw/VBCgovJ5xB0+Ahi8/h1f5j7jTLVkT6fM1n0AT uB2uCximDQCvinwKk5KgV/GLajDojk4YdY9cnvP+0YhaTsOgD/1wBQiJfiN5lfNkjQP5/W Z/MZOI3BtR7zi6NqDZgRsxBX3DH5s5A= Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dfa74b25755so2462799276.1 for ; Thu, 06 Jun 2024 14:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717708126; x=1718312926; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Mye/YuqNKSozWj2ToP+PBiLkrDhSqJxsbKIKLkePCYI=; b=mQFP4CNGiJJOblIkDKagZlZfc0LMmFZpFjGf7YF2AiheScbIvSpitGXQtnn89flsUx 7VxKsJXE135T9GZzthDWjqGs9C9t0Z9+IZdta7oPel8muqvcxURUYZyEJ2mZWLMsS360 8WzaCgFc/GNsSnKSbYWlOEvDHUQYUfCaaa/lG1mzXaxtJTk7Rawfh8yRV6xjbJS7GC74 LCocybHkdfo4QP/Ac++8UuBYmfjyfvuupOMhxPR3as6KOHIagw4uNYms7PUN8VpmwtAm BCaLojmeEsHCsa7uCPnHAt74iHPq23izbvKSTvhvREInf0pO/JmFnTZkplpBWK8j6DFd Wldw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717708126; x=1718312926; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Mye/YuqNKSozWj2ToP+PBiLkrDhSqJxsbKIKLkePCYI=; b=O/ZS2sNl9KUE+09BHpMAtyHo+hhgap/9E9bfYEdYHgI8DJ0eJlZqn6U4zgfBGGYdY2 nb9/jdTO7BWQESLJzMH4lrfZAPour0K6ExCAB69oxwMiVca3AQIYAU2uxdkWXlLTju56 dEaoz/CV2/RySC+uFrzo06KubuMo0u4dBuauCXJBlr1wm8O+X6QlROmf5NOlqUqxDVE6 yGY07FyvJ592WyckvkQgr1p39heaV6w+nmonmxD4CAUVESan4m5PoMCfHVJYJh8moMSZ 29lPC2N2PoE3MNcfd0QiV8y5WM5sXaITPiHkOPsUEYfOb8RdjlqfIaqNGJCvqxBaG/uZ Ntbg== X-Forwarded-Encrypted: i=1; AJvYcCVXRB+SF6vi9b4NsHGSEygoff5ILNRc67sDfTJg5Ol2mj7qU2ZtgvZ673YnqdiiOMCkexqLrSAXk4tvZdN28pSt5S0= X-Gm-Message-State: AOJu0YxSU4PfynDGn+4cU9oQFnBbfYBIAyIMyX9ZF5vTQZNHNEk2PPzy D2/GczCX3PA7gi0iVuGtFXRgBDy+4EDmf6yqoGQnWJMAF78HvlkckZHS/W4A5g4/C2VHXGaLJir 8pNkPIW8kEEUq9BGVdw== X-Google-Smtp-Source: AGHT+IG5eZu2alNNou1PgVUYAuSn0/HSugrHQxS37yxt94oc6r8ncA4WHMp4irRp7eN3oydZ5YZmw9L8MaKII7dQ X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:6902:100a:b0:df4:ece5:2720 with SMTP id 3f1490d57ef6-dfaf6608d72mr164831276.13.1717708125555; Thu, 06 Jun 2024 14:08:45 -0700 (PDT) Date: Thu, 6 Jun 2024 21:08:40 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240606210840.1650341-1-yosryahmed@google.com> Subject: [PATCH] mm: swap: remove 'synchronous' argument to swap_read_folio() From: Yosry Ahmed To: Andrew Morton Cc: Huang Ying , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Rspamd-Queue-Id: C6FDB100008 X-Stat-Signature: w6zqob5tfod164idtpcbw55ccgub7jsz X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1717708126-326853 X-HE-Meta: U2FsdGVkX19PNapzrYJMQv3ES4OzRkaVRjkiBmoZ47RKBw8MYZz4MuvkhHG4NmCvrBrLF9tPK95R1iJ7xLXc1hMek1MWQa+8mESnMhgHcbD01zQsI5pm94NXRoV5/jDIiU3twMQEMvPjOZejPnbjPkPXydcSK9i1rDeJGzlGmsljqEa5Ak8uou6edjETZ4+5wuXja5PAHURpIWe8oTHHkwG7rK5q0ftXV1/JgKddfka1mKpfUjXg8qln9gVS0EnT2sU3QBfFayBNdLRtr/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cKT6+4fP8sBwOaQL43bXVEReB/uf8z+oPPfoD6yV35rDzX9PY/1drjvF50AIC1JgOZ+hN0I78jhYGP6spXhl09ajTTgEHj0D20ftSdXGYmGh4zb3MBl5kj+HF7d/P8mO583geB9HH5j2zOQXOQ4c9+nmTZ8R2OteEQGbeelze59IyE5nBHzS7LID71JefA6sHhoVBy70YlJdyfEmFry1FRTghQMuYpgqEwXDK36Rl2aUIuiINBLAKyR1wYGxpEL3sSZcYqH8cMT3ESqkyJQC1p3zB8WRGlloPsIJj9VeWB1vOX4GrIMB3vF61+BCJ3iC6CqxohGBvA086AMjGpAOHg== 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: List-Subscribe: List-Unsubscribe: swap_read_folio() reads the folio synchronously if synchronous is passed as true or if SWP_SYNCHRONOUS_IO is set in swap_info_struct. The only caller that passes synchronous=true is in do_swap_page() in the SWP_SYNCHRONOUS_IO case. Hence, the argument is redundant, it is only set to true when the swap read would have been synchronous anyway. Remove it. Signed-off-by: Yosry Ahmed Reviewed-by: "Huang, Ying" --- mm/memory.c | 2 +- mm/page_io.c | 6 +++--- mm/swap.h | 6 ++---- mm/swap_state.c | 10 +++++----- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index db91304882312..2b3ef08e8bb7d 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4113,7 +4113,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) /* To provide entry to swap_read_folio() */ folio->swap = entry; - swap_read_folio(folio, true, NULL); + swap_read_folio(folio, NULL); folio->private = NULL; } } else { diff --git a/mm/page_io.c b/mm/page_io.c index 41e8d738c6d28..f1a9cfab6e748 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -493,10 +493,10 @@ static void swap_read_folio_bdev_async(struct folio *folio, submit_bio(bio); } -void swap_read_folio(struct folio *folio, bool synchronous, - struct swap_iocb **plug) +void swap_read_folio(struct folio *folio, struct swap_iocb **plug) { struct swap_info_struct *sis = swp_swap_info(folio->swap); + bool synchronous = sis->flags & SWP_SYNCHRONOUS_IO; bool workingset = folio_test_workingset(folio); unsigned long pflags; bool in_thrashing; @@ -521,7 +521,7 @@ void swap_read_folio(struct folio *folio, bool synchronous, folio_unlock(folio); } else if (data_race(sis->flags & SWP_FS_OPS)) { swap_read_folio_fs(folio, plug); - } else if (synchronous || (sis->flags & SWP_SYNCHRONOUS_IO)) { + } else if (synchronous) { swap_read_folio_bdev_sync(folio, sis); } else { swap_read_folio_bdev_async(folio, sis); diff --git a/mm/swap.h b/mm/swap.h index 2c0e96272d498..baa1fa946b347 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -11,8 +11,7 @@ struct mempolicy; /* linux/mm/page_io.c */ int sio_pool_init(void); struct swap_iocb; -void swap_read_folio(struct folio *folio, bool do_poll, - struct swap_iocb **plug); +void swap_read_folio(struct folio *folio, struct swap_iocb **plug); void __swap_read_unplug(struct swap_iocb *plug); static inline void swap_read_unplug(struct swap_iocb *plug) { @@ -83,8 +82,7 @@ static inline unsigned int folio_swap_flags(struct folio *folio) } #else /* CONFIG_SWAP */ struct swap_iocb; -static inline void swap_read_folio(struct folio *folio, bool do_poll, - struct swap_iocb **plug) +static inline void swap_read_folio(struct folio *folio, struct swap_iocb **plug) { } static inline void swap_write_unplug(struct swap_iocb *sio) diff --git a/mm/swap_state.c b/mm/swap_state.c index 0803eedeabe3d..994723cef8217 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -567,7 +567,7 @@ struct folio *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, mpol_cond_put(mpol); if (page_allocated) - swap_read_folio(folio, false, plug); + swap_read_folio(folio, plug); return folio; } @@ -684,7 +684,7 @@ struct folio *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, if (!folio) continue; if (page_allocated) { - swap_read_folio(folio, false, &splug); + swap_read_folio(folio, &splug); if (offset != entry_offset) { folio_set_readahead(folio); count_vm_event(SWAP_RA); @@ -701,7 +701,7 @@ struct folio *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, &page_allocated, false); if (unlikely(page_allocated)) { zswap_folio_swapin(folio); - swap_read_folio(folio, false, NULL); + swap_read_folio(folio, NULL); } return folio; } @@ -834,7 +834,7 @@ static struct folio *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, if (!folio) continue; if (page_allocated) { - swap_read_folio(folio, false, &splug); + swap_read_folio(folio, &splug); if (addr != vmf->address) { folio_set_readahead(folio); count_vm_event(SWAP_RA); @@ -853,7 +853,7 @@ static struct folio *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, &page_allocated, false); if (unlikely(page_allocated)) { zswap_folio_swapin(folio); - swap_read_folio(folio, false, NULL); + swap_read_folio(folio, NULL); } return folio; }