From patchwork Tue Jun 27 04:23:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13293980 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 CE567EB64D9 for ; Tue, 27 Jun 2023 04:23:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D35D8D0005; Tue, 27 Jun 2023 00:23:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55CF98D0001; Tue, 27 Jun 2023 00:23:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FD588D0005; Tue, 27 Jun 2023 00:23:31 -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 2F37E8D0001 for ; Tue, 27 Jun 2023 00:23:31 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EA2911206CD for ; Tue, 27 Jun 2023 04:23:30 +0000 (UTC) X-FDA: 80947233780.11.C2AF947 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf02.hostedemail.com (Postfix) with ESMTP id 15D9B80020 for ; Tue, 27 Jun 2023 04:23:27 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=dHheU6IC; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of 3P2SaZAYKCJwOQNAJ7CKKCHA.8KIHEJQT-IIGR68G.KNC@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3P2SaZAYKCJwOQNAJ7CKKCHA.8KIHEJQT-IIGR68G.KNC@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687839808; a=rsa-sha256; cv=none; b=rzjexIYNA+UX5iwCby9I7tdYRUam6aP7ni3akgXVfKMApxXkBqFUzAdeAgh1d3SFcdBgmq 8Q4mnMoR6DROU70hZXoipuqgK1rwAOvlgbEXzNuzhklyuHTuAKIzLkR2WwEzCQDtWBekKB pS1ezfWtpm4+txy8/fI5MEjfcK64fDo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=dHheU6IC; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of 3P2SaZAYKCJwOQNAJ7CKKCHA.8KIHEJQT-IIGR68G.KNC@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3P2SaZAYKCJwOQNAJ7CKKCHA.8KIHEJQT-IIGR68G.KNC@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687839808; 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=o3AoGbebO2/sjyjLq3ryUCG8xyOW9r1weM+cOFZBuLE=; b=F73hsRKLnQcqAyaiBGDKNYj3q5AHDILbxaIuGav4QZgnXdzfPcqYoxSrRCCpSovBPMFzff kjxOersNt78nyGxPHzt6hnwWq1B24jMKKOAnsKeucSMZyDQ2NRHbxGY06nPu1hBqc6SWRp 02wZEHWizxXUnCognFfBh3uZAb4qf0M= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-c1039cbba72so6116245276.0 for ; Mon, 26 Jun 2023 21:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687839807; x=1690431807; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=o3AoGbebO2/sjyjLq3ryUCG8xyOW9r1weM+cOFZBuLE=; b=dHheU6IC1gE4LjWZbQ/IniaV5DkcPhnNF8syM8uOEowX24NwDyxL2jv7tc6FMBV27G 4Rxqr6ibWCntKsVRDQuwZtzhYYD6gJJ2gf36p8H6RGHXmOM8wDs4xTT/AlcWoevHEkxS v11okL1qKsR1gEcM8TCR0a/PdkjPb5Pq5EFqxbA0tdJVQ5Xuw5GeD2Ni9wv4/5tL70nq RQBUnOCAF8gaCTtKz4Rjw+9hMKvCgHNAWYRPVUKlT6kt/uP3e/quWkiQpWjZf2l4itqS 1KtiecTwEsABkWVxwh5d4fxy32LDKhCX/GgNJwBCk69VtHXh+xGpl12LuLk4+qxVZJeO Od9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687839807; x=1690431807; 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=o3AoGbebO2/sjyjLq3ryUCG8xyOW9r1weM+cOFZBuLE=; b=VbExdxnNhbs5drm/gMo8S/TQMbplQNzsnNRW4JJr39j062odM45Ypiro7YDjR8zKkm /hdKUaAXlM/ATNwkaaiZv34XarsSfGIS+qLeH1wywRhlojSGQ863Ch1wsiKP+/jXb6Ga sLKaQ69ceGXXBjW/3euktrqO8616xliztBwE/RDI6k1J67NfPxtd5t4nn8BskHbFhp1y nISYkF74s2Dw3AU6I4OH/ewh1UU+/jv2SUEdSv41e6a3gkH48j+gQM8/PJFLw0gGnIJD XTvkey0tctteWyd3cEjK27vCnJWoBshGve3sx11HPBK2lRVSQU4vS9pCZdeCD/NJyddJ +FXQ== X-Gm-Message-State: AC+VfDwMZNchKH7VcpJX/YZvTI/CXKBYqd8WSRdKErAuvKaOEQQ0kilm KcIee0TIpUFLZa8yARr4xOWW/7OsobI= X-Google-Smtp-Source: ACHHUZ5z6WN5yIbltZSphoAhRLFW8PERhElNtWSsbrV8xNDcki//Fjq1aVBOXHRZFF3wnIZEH2iDfzPMLKI= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:5075:f38d:ce2f:eb1b]) (user=surenb job=sendgmr) by 2002:a05:6902:92:b0:bc4:a660:528f with SMTP id h18-20020a056902009200b00bc4a660528fmr10901839ybs.5.1687839807170; Mon, 26 Jun 2023 21:23:27 -0700 (PDT) Date: Mon, 26 Jun 2023 21:23:14 -0700 In-Reply-To: <20230627042321.1763765-1-surenb@google.com> Mime-Version: 1.0 References: <20230627042321.1763765-1-surenb@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230627042321.1763765-2-surenb@google.com> Subject: [PATCH v3 1/8] 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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 15D9B80020 X-Stat-Signature: rdi7dbhjmk14ox7a7jydfnr1763omhzn X-HE-Tag: 1687839807-660066 X-HE-Meta: U2FsdGVkX19DIF/Y7pjMYN58k853gVdAjbLw8QnKm24XrvQju7YS47PxCI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0AzVSSxXZOJRvDGQmM1DkYZVRGX6568/JLv1K20fdllcsrp+U8+uq3OadeWy+LdT74Yknx9tlvtbsFNREpwW/KZ/xqJBAGk8louJYpwA8YvNQgsZb4SGhvdgO2Kdg3pGpivfw9JO88E1PUJAd3/2gheGoZ+qBCBz8CevwNUdo4yl/mLpoB8IT5PWnn0+PN7tbIDBYRuph3b9kjPCyF+nrz+s4FRZnFZsUmZqVWOqJxp90EXS32l8M+c6Y6SGYyzEHOSAiOfkly1QzN4OWNoEcPti9+RSH5mPAM8natHZSgZzPUsWNBFRPyT38dqyn5y+dozgmYP32lW1whSdnX8cT36tQsL4UdT/mCkP2giD9o2bpvSFgUzeFuzcPbCFkvH/425FavizWfxZHmJ2FdjCi+lzQqNjPv7Ml+0q1qlacjP2hTtXJoVqmiEFfYrnZWxrSpLTYyGoOt/aQ4vu0buf+Yz1tphe/Xq6qa6+ev7V4zG8Ve/zViw92i3vMWr99+Rl5IEl/lMOM5x/YkgAG64opcwPHooVRWlPUug== 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); } /**