From patchwork Wed Jun 28 17:25:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13296084 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 9C9ADEB64D7 for ; Wed, 28 Jun 2023 17:25:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 183828D0003; Wed, 28 Jun 2023 13:25:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 15AD98D0001; Wed, 28 Jun 2023 13:25:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F18718D0003; Wed, 28 Jun 2023 13:25:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E424A8D0001 for ; Wed, 28 Jun 2023 13:25:39 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B7B55A02E1 for ; Wed, 28 Jun 2023 17:25:39 +0000 (UTC) X-FDA: 80952833598.26.4C17A04 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf25.hostedemail.com (Postfix) with ESMTP id 8A249A0022 for ; Wed, 28 Jun 2023 17:25:36 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=e6SPrWEk; spf=pass (imf25.hostedemail.com: domain of 3D22cZAYKCIY241oxlqyyqvo.mywvsx47-wwu5kmu.y1q@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3D22cZAYKCIY241oxlqyyqvo.mywvsx47-wwu5kmu.y1q@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687973136; 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=Wk4WxwRsv+3hJEQqD6hkh6qkQyyhqDxtIIhtJVZ2C3xR+qd3TPbc4fJ0e0Q1cMCXYnA23r gf6/cdsLCwnFRebjhvH3sUgo3A8vCwKapzDxOQOwxYyEnWcmtcoIWRpmrbabXtHPTlwKNs Ek8N1DAXEotBDg9Lt9iu4jqBa8II1AA= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=e6SPrWEk; spf=pass (imf25.hostedemail.com: domain of 3D22cZAYKCIY241oxlqyyqvo.mywvsx47-wwu5kmu.y1q@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3D22cZAYKCIY241oxlqyyqvo.mywvsx47-wwu5kmu.y1q@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687973136; a=rsa-sha256; cv=none; b=T66h8clFmOeJPEIF1HfG02tSj5BFK2YaTNbfnc251+2RCt62u+CL7NKggT0Q6qn4LxE0xm ACbmow4OThi+4fYGOZLW3kwVJGQtOk5KmjM+f7upuoKlfSSpnOGXUN+fjMeqL+wW7ltqVN NtnCs+qQg5GR1+nPu+VHIOXBCIiDAoA= Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-c17812e30b4so5309429276.1 for ; Wed, 28 Jun 2023 10:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687973135; x=1690565135; 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=e6SPrWEkGiS7vhpHhhy37EcTRVrgLixp2j9nc9EBXVKej7rIbih+NkwJb1MJn3rRDX 5muFPgNOpa6ZEK4o/0O1g9m3lbEwIyCcXkljX26TsSqupAwnhpmWQRx8CDSGC558JJIO zsfH9ZLyWCPVb029aawxSuzo4keH1XGw00BY/iVUfHzSafcc2ABx8vXH3xmVaWp7skVn YIYwuCss3vEqI8yrAYLu29TIrCDFEXYAgjNrcxHG3KB3oPG2oESX91b3haK9+Q4XKU6Z styvaJQzhk+b5f88CjLax8vu0Fc8jk/0sma4xwI+oS81IE2WBsB+5IiiWsfpeaCvJ4UY vfrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687973135; x=1690565135; 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=Mv1nWhSJDY5WLyKkkz9oTDGfgDh4iwvY4Il2tJYEvmVXmIf7TdMEG+VvmkRGEAJ09A yJ+9FN8Xc/9cInhDqCwG3/V+p+BGOd+GNrna7GTOncX7iK9tf56CB5RDs+iWwHTTMNWT 6d85d0Fj8OPoiyi/95sh7BJe34tGWAbx6w0QJWAGWnInN6Ynp/2q8eGNLBfiTI5AM8r9 bJ/WPFDDNTTBAaIa8ZWyqAlwz0x5CzPknJ+alYh96rtnzN82x46XmxMcRfVFkgkGndh1 FPTpJ2hF2u1ZhMs6EYVMRGWWNS8nMJ8z1kskd9GaEjlsHyq2ZpjaciU2rSVbQTKm/1oM 9KfA== X-Gm-Message-State: AC+VfDy7Pp2XX4U1QUzMashV1d+Hasjv8Sg43oqCsooDcQHrT6XIChu7 Q3mR1B9hd8Biwmn0W1+iKXYzS3Rpa3A= X-Google-Smtp-Source: ACHHUZ6N7gWosjP8G3HWgmkBJCbFxP8A/hCoy48IKxEWFUFucTCUbC4VUp9YtI79x0Uj4BJMkP4VIAbKaOk= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:eea3:e898:7d7a:1125]) (user=surenb job=sendgmr) by 2002:a25:2f95:0:b0:c15:cbd1:60dd with SMTP id v143-20020a252f95000000b00c15cbd160ddmr3699476ybv.5.1687973135437; Wed, 28 Jun 2023 10:25:35 -0700 (PDT) Date: Wed, 28 Jun 2023 10:25:24 -0700 In-Reply-To: <20230628172529.744839-1-surenb@google.com> Mime-Version: 1.0 References: <20230628172529.744839-1-surenb@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230628172529.744839-2-surenb@google.com> Subject: [PATCH v5 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-Queue-Id: 8A249A0022 X-Rspam-User: X-Stat-Signature: pyzhf9nwhof7sf4bngirusw36nshemr6 X-Rspamd-Server: rspam01 X-HE-Tag: 1687973136-371353 X-HE-Meta: U2FsdGVkX18pap4mKg50R85wQ0Eze3itL3oVem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ZDi3XKf6oW6/q3z1w7nORlE059ZBYaN8b+16Bmx7lepauH96bumaOTKyv7Gp5/LDddemx2PAWJ5GDBuSmFzxDNd6dVEhHnnSOCmPraEO35FUKi15FdwzpMWxa9lwJU+4BTkAktN51h/h9PvlUM2qfyep0IeXcWcmFGLcS8XNxv7Q0IIdzo9zI6aMxw4B+W+wwAeKsYNgWQzgsVePZAbiDY8suFCkob+5fTQM63aD66gTWDuoeneLd79Ce6ZZ+D1O+LJUKMW4BdG4/beIjiAaJr3Yt1F3Qqn8vhi/BRuekAMqqAnoWdiA41l7T15pE+iThDI+t1cCSN9ehKM/sqm0BKr5s8WFWgGBRF6EwdGyxrXyVr3O002HN/J2BjhAgB07qIQ4I7VtubUVGu2QPNaxFEcKTBsdq+xeN+cSODcXReJsRWo3A/LKl8958Ql90wCDARrY3q4iKJXfBKfdxPl9f+8SzqWOEF3hgJCWtV/4rQpmURRathpDH3F/s0GgltOwHUemUNxve92SdyVS0tRn2L2RD1mD6kiYOlzwbz/0xLMQRUs7xGPpoKbpYHeb6ZWmBxgHg3uFJ3ubmFAYRQ== 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); } /**