Message ID | 20231119194740.94101-3-ryncsn@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 553A9C54FB9 for <linux-mm@archiver.kernel.org>; Sun, 19 Nov 2023 19:48:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D465A6B0353; Sun, 19 Nov 2023 14:48:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF4776B0358; Sun, 19 Nov 2023 14:48:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6FBA6B0359; Sun, 19 Nov 2023 14:48:12 -0500 (EST) 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 A0CCC6B0353 for <linux-mm@kvack.org>; Sun, 19 Nov 2023 14:48:12 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5162B1202E1 for <linux-mm@kvack.org>; Sun, 19 Nov 2023 19:48:12 +0000 (UTC) X-FDA: 81475740024.25.1795918 Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) by imf14.hostedemail.com (Postfix) with ESMTP id 70C3010000C for <linux-mm@kvack.org>; Sun, 19 Nov 2023 19:48:10 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iuGEW+1O; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.128.176 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700423290; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cduqWiCMIKVDQKzalcbjrj5u/UZrGRNgI9eE9WPHu3A=; b=7nbf1htpF+i4CTLyQy05VNE2rHWbzm0ylSDJScKZrR/hz+qr7OTIQdUE3Ct7fJv4+uCd9l 9oOs9WCORTtWgUYhHNw1vgIJmGEki6mRzY+RP1hji2/RyuM8Zteclghwuiw6htDv0QXHNx 6JRMQPZNP3m3dZJSuZKd3pwhysxRu4k= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iuGEW+1O; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.128.176 as permitted sender) smtp.mailfrom=ryncsn@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700423290; a=rsa-sha256; cv=none; b=ZyuGj6AiNk4FOGTRxQD7/agmnN9EoG4SaSXfoGNSPRBk7siunMK9UB7Tv64ybYQoBQ8XUo 3D4d31d+gtKIwd0xKDLkJpe2WnHmAB7yqyp9cWxPNZyElnzxRMU+/R18eOb+UMs+xZz8o9 y/IOvaZUlYH2kZvs6FU9S84BUL3faiE= Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-5a7dd65052aso41904847b3.0 for <linux-mm@kvack.org>; Sun, 19 Nov 2023 11:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700423288; x=1701028088; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=cduqWiCMIKVDQKzalcbjrj5u/UZrGRNgI9eE9WPHu3A=; b=iuGEW+1OekJhCObuF4gAj5DOs/WBs4FELHna2G3aF4FD5FDSu9dTkKoi8o0OCzbfVX 6pLeUAWKCLg+HzJKwxw6US1B7qDydoUWxFMn3vYnbvK5Ev7PUNpNmttvWJOwaRvwj1w0 YF2thl8588FqBXQ9d8fwR4pHkmUfEtYE+tWhuZOJbAmjF8ANyoaBtdySCPemfrT8sclQ lYgNKat7YjA5Ncb3STLsqFN38uJ+u1tG+lBq8sqCCwObpHhndJbZkKqGIDKGQm7Bs/Hj aOcYvyhrR0fATOiv6icc2uSjWvTI3imsoMI8BE86y4YlhNlbsl2j0CjLvtUdqwwl7Bkm lCDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700423288; x=1701028088; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cduqWiCMIKVDQKzalcbjrj5u/UZrGRNgI9eE9WPHu3A=; b=YeWr1II1kiWndwaOEdhB/Yfp4D+asvP7ha6vkj81Grn+GZ1tqGOyme4ZIjTCHNowJ0 HZ8/gpFwYeCVvESaVTTe+o4QrdzKuIMIMBbwxws6Xxc60KNgrDMSH58WssRkLRVN8nH6 m50g88rHxy+gxRsqbUAbEdZb7UOUpA7TtQjFxe0ag4eFP8S74y3yAiOlPxl32DAHE/qz KJ3fcFi4NO+EdTHH7qIJkX9inYFUF1f8bnJhsYLqqh8zyjTKntmxI7neBfxNAnXJBgJE lYc7UHljZzD1uST74bzgdvWu2jjsFRPoHxTscE9Xk8pmfmU2rucV9F8Tk6ytXS7WsbhZ UJ3w== X-Gm-Message-State: AOJu0Yykj+cmG1Bay41BPZTl3qHwhyclR8vmaIJAS6Ptqx6I1ze0QG5i FYmUL7ZSE+ph0d7pPaPdytfiMMRh1sjPT6Bd X-Google-Smtp-Source: AGHT+IE1y2y3wIZaEr+VeLd45/7RB5OVC0un5QZpdb1Dva1zs1cgZibYuz6x5YXuFZ86VBTCpW+iXw== X-Received: by 2002:a81:4841:0:b0:5be:94a6:d919 with SMTP id v62-20020a814841000000b005be94a6d919mr6198288ywa.25.1700423288412; Sun, 19 Nov 2023 11:48:08 -0800 (PST) Received: from KASONG-MB2.tencent.com ([115.171.40.79]) by smtp.gmail.com with ESMTPSA id a6-20020aa78646000000b006cb7feae74fsm1237140pfo.164.2023.11.19.11.48.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 19 Nov 2023 11:48:07 -0800 (PST) From: Kairui Song <ryncsn@gmail.com> To: linux-mm@kvack.org Cc: Andrew Morton <akpm@linux-foundation.org>, "Huang, Ying" <ying.huang@intel.com>, David Hildenbrand <david@redhat.com>, Hugh Dickins <hughd@google.com>, Johannes Weiner <hannes@cmpxchg.org>, Matthew Wilcox <willy@infradead.org>, Michal Hocko <mhocko@suse.com>, linux-kernel@vger.kernel.org, Kairui Song <kasong@tencent.com> Subject: [PATCH 02/24] mm/swapfile.c: add back some comment Date: Mon, 20 Nov 2023 03:47:18 +0800 Message-ID: <20231119194740.94101-3-ryncsn@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231119194740.94101-1-ryncsn@gmail.com> References: <20231119194740.94101-1-ryncsn@gmail.com> Reply-To: Kairui Song <kasong@tencent.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 70C3010000C X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: arunpync7birhsrqwrs761uocqpmzmia X-HE-Tag: 1700423290-561276 X-HE-Meta: U2FsdGVkX18CF3UvzckayHnJkUa0ywVMAYaGRSjmcT1pnTYuzGY8v/UAjvfysN6TMPCAE/AY59n6jJRWueMwp/ywAj3dSrs2VihD1LrLi8AOgWqMkyaWXpXdY3F4Nv2Bbwld53Spcw3BXGu2IoKDvd67JIsUfpLj9+yIQHNCDwa0K6y5YUCNNC1w81p3q28tXOqcIF3Ultx7tGlTGIf8xUSor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AXMpsuTHMaJ/f11WGmUV6nQzPNZxwqd+F/eTvZkBSQnLIXemJO1N45G1Nh5otT0wlKtvu4fU012LwYbZ/tW8KE/zVbP6nQvus+L+VJJE0e29QWosAW4/jYNyPu+/T0ebkRV0kLjHNMl0twY53XJjgzL4fyNPjVJ9+K78mwMPizxkzEjHGa+VxzCF/bmVZ3Stq0wgPrJVg4vMbQOyUZNFoF01zrtPbwKk4SM21FdF//O0LOirkaPZxnO2OSqyVXT/LsLsfRhQKzjHa+gDV3jjGdt74KjJbdH+y5yVlkPu9Y3BXrkQMVf9uzVphl4vLc8OZoEDK40ds/193j55EVRz1+P 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Swapin path refactor for optimization and bugfix
|
expand
|
diff --git a/mm/swapfile.c b/mm/swapfile.c index 4bc70f459164..756104ebd585 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1879,6 +1879,17 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd, folio = page_folio(page); } if (!folio) { + /* + * The entry could have been freed, and will not + * be reused since swapoff() already disabled + * allocation from here, or alloc_page() failed. + * + * We don't hold lock here, so the swap entry could be + * SWAP_MAP_BAD (when the cluster is discarding). + * Instead of fail out, We can just skip the swap + * entry because swapoff will wait for discarding + * finish anyway. + */ swp_count = READ_ONCE(si->swap_map[offset]); if (swp_count == 0 || swp_count == SWAP_MAP_BAD) continue;