From patchwork Wed Jun 28 07:17:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13295271 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 85867EB64D7 for ; Wed, 28 Jun 2023 07:18:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E99A18D0005; Wed, 28 Jun 2023 03:18:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E49158D0001; Wed, 28 Jun 2023 03:18:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D10868D0005; Wed, 28 Jun 2023 03:18:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C42128D0001 for ; Wed, 28 Jun 2023 03:18:11 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 847621A0B56 for ; Wed, 28 Jun 2023 07:18:11 +0000 (UTC) X-FDA: 80951302782.24.8F44109 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf24.hostedemail.com (Postfix) with ESMTP id 357CF180009 for ; Wed, 28 Jun 2023 07:18:08 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="0ku/s7JO"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of 3r96bZAYKCAg02zmvjowwotm.kwutqv25-uus3iks.wzo@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3r96bZAYKCAg02zmvjowwotm.kwutqv25-uus3iks.wzo@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687936688; 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:in-reply-to:references:references:dkim-signature; bh=KMxqHAnxOZxMzgoGe7kH228DI7ZaEMF5Tfki0D7IS+4=; b=c3YjkoobkWkR8rm0pdnrV8JePeWlatO9XBIG1Tejyn2nP3hcLBe8R1vDRnpFHBGbtvQDEL oNKQsoCjYcTMur/jrbNDA00ITh9DHDeFOhc3HJWbsNlkycCB2xgVS3hdVLLiUH821t9gFp axPmD7kFi+73q8hDclTNMsTagWPQ2Zk= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="0ku/s7JO"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of 3r96bZAYKCAg02zmvjowwotm.kwutqv25-uus3iks.wzo@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3r96bZAYKCAg02zmvjowwotm.kwutqv25-uus3iks.wzo@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687936688; a=rsa-sha256; cv=none; b=ZrZo8yGFw4RNV2zO0DPqz8rfQneD528CFaO5XwKyITAEj4KezCHKiZFbAIqfjDBS30lGwS EBc4MFL/gsL5GBJ99rPIFRBNfuTrSYe17Fr9m+Lx89u6vMtUQulpke7t/0K74ZMN7DWOTG lhS4YL0GtXoQK/1rmhmMpDIME8DRBMo= Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-bb2202e0108so7006721276.1 for ; Wed, 28 Jun 2023 00:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687936687; x=1690528687; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KMxqHAnxOZxMzgoGe7kH228DI7ZaEMF5Tfki0D7IS+4=; b=0ku/s7JOYS25Ssb/TK9mxmOCJZLqRDj28TLTN+62uIW3T4PAT40AConihZeYPJTuOq pBmwei8rFDKCDPJYQM/skpek57YiLQZ/I9oDiT8X2vG/yxx4Dm3IMC0Fyd5cTCXMjOid Hvts2kbEwT9xvJP59WbeiRbQhvsolauFOVtF5WAyU9YXglPphuRZ4vp5aNLZXnXNqulh Y8IrfvL6jaaFFk//+Cx/JuQEsx0g+IpMojHToC/AwAtitwx/DGOeNqxGL9NZxDh1HgHf YE4xBByujQnhsw5d6CLOwIuIStkTt0ijsqcyJU3qmVpzuvpNJRGhd9YpjjxbDugjGePG Qu2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687936687; x=1690528687; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KMxqHAnxOZxMzgoGe7kH228DI7ZaEMF5Tfki0D7IS+4=; b=KLcLiugxrTenbs+C/3nU4m8BhWRTP1+y/D5/6lh528dHmQdIIFRSNR3OJQ/Z4TadVT iJAhCXd6vGt4oTQzaQEI3pDVF49BdM4H+7y6eAU1+mjBw9nmalCNx+k0SbO11aeSfMXu Zi+q63XpuSSUcUp/tFNqWQqpRA/WyDkHmKL/ZK52dyO3Ozm+7FvCYWzwsa7VSX7LH6Lb fTBeXuv+dhvq15aIwpu00CV7AiYB1vDRGJAHUGNbjT5X4jojaIAzxKaK/z2U0FogRqgu DiXXUjr35g/gDVELrp0FBQ0mpFFye7O8u8y/JC4MaOG0LEXaStTDTOXhIGzS+cWakk10 dsCw== X-Gm-Message-State: AC+VfDxVoI7HMVxT4mSpEl7XKNomN0uscxKIWUvPSU6PC7CbB3JrUWT1 1dQDdysSvg1ih1Bkvyv0XVys9IySB4Q= X-Google-Smtp-Source: ACHHUZ7N2+Vdz5wzVt4qo3ORJk1cvXaFXFgrNn/dwhdlBeAqH0Ef2MJ/aZaUm1mJL36im1QJNi0z39SWTj8= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:6664:8bd3:57fd:c83a]) (user=surenb job=sendgmr) by 2002:a25:ab82:0:b0:bb0:f056:cf43 with SMTP id v2-20020a25ab82000000b00bb0f056cf43mr7882151ybi.1.1687936687271; Wed, 28 Jun 2023 00:18:07 -0700 (PDT) Date: Wed, 28 Jun 2023 00:17:55 -0700 In-Reply-To: <20230628071800.544800-1-surenb@google.com> Mime-Version: 1.0 References: <20230628071800.544800-1-surenb@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230628071800.544800-2-surenb@google.com> Subject: [PATCH v4 1/6] swap: remove remnants of polling from read_swap_cache_async From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: willy@infradead.org, hannes@cmpxchg.org, mhocko@suse.com, josef@toxicpanda.com, jack@suse.cz, ldufour@linux.ibm.com, laurent.dufour@fr.ibm.com, michel@lespinasse.org, liam.howlett@oracle.com, jglisse@google.com, vbabka@suse.cz, minchan@google.com, dave@stgolabs.net, punit.agrawal@bytedance.com, lstoakes@gmail.com, hdanton@sina.com, apopple@nvidia.com, peterx@redhat.com, ying.huang@intel.com, david@redhat.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, viro@zeniv.linux.org.uk, brauner@kernel.org, pasha.tatashin@soleen.com, surenb@google.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Christoph Hellwig X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 357CF180009 X-Stat-Signature: fdeekhnow3jtry8jjphj4m9u3qom1x4y X-Rspam-User: X-HE-Tag: 1687936688-84787 X-HE-Meta: U2FsdGVkX1+3PY2NSw+CqPL8yVJpjrYM6T3Q5oi1QNE1V9d4MDL96fSfF7U8KqSN5r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F7KTVcj2uHKsw/ew5h8ROOTShcz8vp7wqtY9x26LSTmukWjv1ZdW1AWzSRcwvtAdm/0bUUJc2Af7jpmNPker4kjXE/2B6kCmU8I/lK5borSNgZvkYJr+D/FQvxMzvkLHB/Hzv4MN5Xj37pW+kftXBJrBN2c4ZlaRruazDWT2nHm/nKTkEo2Xdxnis0s2XnpPQElU/gAphArSxocLy7Q0lDq/UQd9A1rJDknrPj2zfjibD/BwLlYRhJsmXxRfDb+mS+LzNFspmbvrqHHGgT62cdPM0BmRRodJKWf/gUClERc1ALizKs5PeFaiSzLkNOttNbHTfUV6Z7LguzUZy2Pi1/PoY37NarzjnYTGL37AfTqlcGQBI6Zn5y/o8Pd3Q7Q/uUKRTAoerQ0YgUntwoUz8pOBYYI6R99uPVh91YwHg65UhdB958adFcIPT8XVkAyioakDDDzHNI2q8Yw4jJFzP1bYPpyGXT3Eb0sKGwDzop0O/ehLTmt9y7U3CzijcdtmiGsWbPezBMiTXbGxaVZXCQZZgVAXQ== 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: Commit [1] introduced IO polling support duding swapin to reduce swap read latency for block devices that can be polled. However later commit [2] removed polling support. Therefore it seems safe to remove do_poll parameter in read_swap_cache_async and always call swap_readpage with synchronous=false waiting for IO completion in folio_lock_or_retry. [1] commit 23955622ff8d ("swap: add block io poll in swapin path") [2] commit 9650b453a3d4 ("block: ignore RWF_HIPRI hint for sync dio") Suggested-by: "Huang, Ying" Signed-off-by: Suren Baghdasaryan Reviewed-by: "Huang, Ying" Reviewed-by: Christoph Hellwig --- mm/madvise.c | 4 ++-- mm/swap.h | 1 - mm/swap_state.c | 12 +++++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/mm/madvise.c b/mm/madvise.c index b5ffbaf616f5..b1e8adf1234e 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -215,7 +215,7 @@ static int swapin_walk_pmd_entry(pmd_t *pmd, unsigned long start, continue; page = read_swap_cache_async(entry, GFP_HIGHUSER_MOVABLE, - vma, index, false, &splug); + vma, index, &splug); if (page) put_page(page); } @@ -252,7 +252,7 @@ static void force_shm_swapin_readahead(struct vm_area_struct *vma, rcu_read_unlock(); page = read_swap_cache_async(swap, GFP_HIGHUSER_MOVABLE, - NULL, 0, false, &splug); + NULL, 0, &splug); if (page) put_page(page); diff --git a/mm/swap.h b/mm/swap.h index 7c033d793f15..8a3c7a0ace4f 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -46,7 +46,6 @@ struct folio *filemap_get_incore_folio(struct address_space *mapping, struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma, unsigned long addr, - bool do_poll, struct swap_iocb **plug); struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma, diff --git a/mm/swap_state.c b/mm/swap_state.c index b76a65ac28b3..a3839de71f3f 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -517,15 +517,14 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, */ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma, - unsigned long addr, bool do_poll, - struct swap_iocb **plug) + unsigned long addr, struct swap_iocb **plug) { bool page_was_allocated; struct page *retpage = __read_swap_cache_async(entry, gfp_mask, vma, addr, &page_was_allocated); if (page_was_allocated) - swap_readpage(retpage, do_poll, plug); + swap_readpage(retpage, false, plug); return retpage; } @@ -620,7 +619,7 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, struct swap_info_struct *si = swp_swap_info(entry); struct blk_plug plug; struct swap_iocb *splug = NULL; - bool do_poll = true, page_allocated; + bool page_allocated; struct vm_area_struct *vma = vmf->vma; unsigned long addr = vmf->address; @@ -628,7 +627,6 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, if (!mask) goto skip; - do_poll = false; /* Read a page_cluster sized and aligned cluster around offset. */ start_offset = offset & ~mask; end_offset = offset | mask; @@ -660,7 +658,7 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, lru_add_drain(); /* Push any new pages onto the LRU now */ skip: /* The page was likely read above, so no need for plugging here */ - return read_swap_cache_async(entry, gfp_mask, vma, addr, do_poll, NULL); + return read_swap_cache_async(entry, gfp_mask, vma, addr, NULL); } int init_swap_address_space(unsigned int type, unsigned long nr_pages) @@ -825,7 +823,7 @@ static struct page *swap_vma_readahead(swp_entry_t fentry, gfp_t gfp_mask, skip: /* The page was likely read above, so no need for plugging here */ return read_swap_cache_async(fentry, gfp_mask, vma, vmf->address, - ra_info.win == 1, NULL); + NULL); } /**