From patchwork Fri Jun 9 00:51:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13273052 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 15BAFC83003 for ; Fri, 9 Jun 2023 00:52:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 902E78E0003; Thu, 8 Jun 2023 20:52:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B2BA8E0001; Thu, 8 Jun 2023 20:52:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72C0A8E0003; Thu, 8 Jun 2023 20:52:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 638768E0001 for ; Thu, 8 Jun 2023 20:52:08 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 38C791401AA for ; Fri, 9 Jun 2023 00:52:08 +0000 (UTC) X-FDA: 80881382736.27.0FC5C5D Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf11.hostedemail.com (Postfix) with ESMTP id 6A99240003 for ; Fri, 9 Jun 2023 00:52:06 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=IyAXoXjV; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of 3tXeCZAYKCNgMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3tXeCZAYKCNgMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686271926; 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=yuiOMQ0aSy0KwUuwsgymDjnxP8/lpeb7/V1M3j1Xb1E=; b=5C74Zm+tr7VgkXv/+FUZnyqdI6TCzRV+pwXTx1fQm7a+MVfQj05g+ALUE0JXhkr2riA+zZ ETUB9o9SGE1hQUC7OO4ODu2W1BQT1bHW4ncwxiVCwe9N3T4SubSKNNHlm7EmQLKVpOFhCK cOG+u7MLDShkQcbFMkUdARLfMSdJmbo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=IyAXoXjV; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of 3tXeCZAYKCNgMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3tXeCZAYKCNgMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686271926; a=rsa-sha256; cv=none; b=sNGOr1AUW4NNlDxn/7Xohar8F57raIj3SNBT06YYlGzROjDXhJudiK3TYfNcduvs/weDtu q2Rs8JcyUun9j7oHYOo6YUJqYhLHhQhRK+XPT3h2TdzhximpqEtgxJDLhpvBDRd50pdKih 58YowXGgH53V/pOnaEy+HfFOs8MGoKM= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-5651d8acfe2so16859347b3.2 for ; Thu, 08 Jun 2023 17:52:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686271925; x=1688863925; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=yuiOMQ0aSy0KwUuwsgymDjnxP8/lpeb7/V1M3j1Xb1E=; b=IyAXoXjV7xCg1A6CTIB0VVGoVOFSNHNynjRms7ZT4ZJuasxkgD/xINqmOy3R2QWmj6 LweWil7YBo9DB23KcYDwjIFg2tzhu/sNAVap1M78azP9/yh5rbc8NVuFliEYHm7NBXMo soQpcPklJ87/HIwm9iXTXt6sGz2j9ugeHoaBCIPXu786yDSkXPG2N+lpjRD03pJqKf4U ynS64LhxDlPhl3xfkAFkbEO/hQz6xagu8ZpHoJtj8fgQugYSIR8+59/FTuzy8cFImM2J 9Fgql8U7ice3Cs5matPGhf41n4PEh7vFyVlNzgNeB1JUE14tptvSHOdWg+sF+J8fGOVy muaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686271925; x=1688863925; 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=yuiOMQ0aSy0KwUuwsgymDjnxP8/lpeb7/V1M3j1Xb1E=; b=b2AmLS2ewX4oW15EAugCmKEqos2uFMOPjFdefKE2bQOQh80hqkSflzk5npEZGAYbWX oFHR4Lo3Cx9op9csp3cJg9RKD6C3Dv017O8BV+zPj6DvFttcfHibdy/z8GIS1wWvMR3L Pae5frGVAd3Mry53+Yxy2cDQZp/hJTeWcM2gsh9Jmv4jGmMuhbJeAt0VlgHNm87as9UG HyULNkfcT4L/Sf+3BVLxuca3YrGWSj5yJoeiyWUttkTOlQYUsKFAx77zyL/FWEkHMUaU mo4LQlkcwOSYpxgGkMBLghDFrh8Pm4AyaoWXWVUu/Qviw7L5jAjR0ZJYwQZciYY4iZuV 59bg== X-Gm-Message-State: AC+VfDzyI6LA5G63GkrzEtm8imPWnECfe8Dm3a6VxKqTMMDWpUccpsLI PxW7CiVa+Koma2loKf59fvOrVQ8w98s= X-Google-Smtp-Source: ACHHUZ7vpO/mcmJj2VKORN5it7Uqz0TT+6LPQeqOxr4F1AyBIL+6jgbr7cmENYkI/PhrqFOCmtLfaWiUoNY= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:c03e:d3b7:767a:9467]) (user=surenb job=sendgmr) by 2002:a81:b2c9:0:b0:55d:8472:4597 with SMTP id q192-20020a81b2c9000000b0055d84724597mr729567ywh.10.1686271925574; Thu, 08 Jun 2023 17:52:05 -0700 (PDT) Date: Thu, 8 Jun 2023 17:51:53 -0700 In-Reply-To: <20230609005158.2421285-1-surenb@google.com> Mime-Version: 1.0 References: <20230609005158.2421285-1-surenb@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230609005158.2421285-2-surenb@google.com> Subject: [PATCH v2 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 X-Rspamd-Queue-Id: 6A99240003 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 6saszfihfgratb1yx3ixgacy93dnexrz X-HE-Tag: 1686271926-21643 X-HE-Meta: U2FsdGVkX1/M1wdcsxsxhZ6CVXVVFZtF4p/eGJkExhxfeTKP+CcpOB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y+hB/O7Z9aJOVu+ynxazNbtVC1rpOYjBamo+oauZjaDYVtQb8VzxMsQGpgXmG0+4Hjkrawa2Ac7S+7rU0kQqCIGW6/8IAN2XWoPKt373FGdwlrZk0CT0ge6+8yzt/hWQprNSiawZPCKZh6+ztFU12QCL8F8vMdfQpexMt7PVfSIp9D7oqpaO8IDutLsKzI/wl1QGIsjBtj0qC7mrsK5z3yPqJVxPmKZTrMxg41JTQyHQ/7EFmJGcACL330/etY4Nm5x+p9GOmQeGMIJvOVj4EGdTYusvEnnFlTMvFxw9amXp3d1fM9sElCA3nulJTO4dQaJpvr1JoHaMJE/ZFTukeP1Oox3jYXa9LVmkIeiVBZXA5YZbkD5YOWm89PyXwCnyixqWGsE93qR8dJur863RzcHbKnJFophBPu6arQ+jREOZVeeTaT1xGiYQ+9x7qv0M+U22kk/gcRlfuQMkEX+oDQCaKoOp5issunesVVWujL8ySW84b8XR8rD6ai6R5I1vMaWtUCi+R+ss5TM981ChGx+a2gyizKdbWOorlLHoyhuadZpw== 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 during 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); } /**