Message ID | 20231119194740.94101-3-ryncsn@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1809556vqn; Sun, 19 Nov 2023 11:48:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IF67qPfg59eMtUSwy3LoGs+IpJoj5XKDdgtouAsnGxktILMl2PqNxrziPAeOjhYOXhlZC5p X-Received: by 2002:a6b:3f86:0:b0:792:9416:9c7f with SMTP id m128-20020a6b3f86000000b0079294169c7fmr6528280ioa.9.1700423303007; Sun, 19 Nov 2023 11:48:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700423302; cv=none; d=google.com; s=arc-20160816; b=kVDkABzPNxrheeFOTaUFFuD7IES/IkXileIHoUSiq+MHVeZM5BJwM88xnO6ZscAZIg bqCe+2SScPHOB5XNFpzkk+S4DRUFZFbGw6No5trpcJJ016LAgsGaBDhKLNSoaPpCxa/p dSPa32LpHMAoQR4DjJahGTQiYAYM0r0ido1QOLmhLMdt5SXhyPBXNtl5AugFwgTWShz6 8ToJBZPbTPHHl5Diz2LTGnHmkDvN6p4GNxCUKqr4vV9lqZzX39HZcKTh31r/JvHVWlgz ypjrfVAPDLmLt9VveU+4iy99YcYqlt2g87mLp6Z6R5Boh8qjzQinf4b0ohtM9jH/igL/ t9LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:reply-to :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cduqWiCMIKVDQKzalcbjrj5u/UZrGRNgI9eE9WPHu3A=; fh=4HE/piJoUCKuBTCCBiej4//zvvzywHdOLL9QM/KYjYM=; b=aIwq6O94jqbmZiUi3FG20jHWs6ciPXAm7L6zuGor7noavQdQfuvTYbteNeENU8S60A Yhh6io0kOnqpAyCOhFibbRZH39O0k/g3Jh986SN41F1FQWwjlsA1HIrJbWk3qO85tk6r vLXQjlEENMdgRODYR0+u+iOE9Mhd3B49Tw2Iam3GNO3Q1cYmYlEi3nhA7C5LexpxwIfE drYYpqTBZRzMNES6f5jhpDDp4/9WdK8c8MBYgL41KGuWkFKZtFVnTQwrScoOZ7Azzpto hbBL/OFSzG3sVzUXq/qf8rwa2bW8dlfINzB86xfnrlZLl0YO3o+1daNrLOgn9AYI0MAt KRAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Y9sAFqwP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b28-20020a631b1c000000b005c21c4a46ddsi4190840pgb.356.2023.11.19.11.48.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 11:48:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Y9sAFqwP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A78CB80A5FAC; Sun, 19 Nov 2023 11:48:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230393AbjKSTsP (ORCPT <rfc822;jaysivo@gmail.com> + 29 others); Sun, 19 Nov 2023 14:48:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbjKSTsM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 19 Nov 2023 14:48:12 -0500 Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3749111A for <linux-kernel@vger.kernel.org>; Sun, 19 Nov 2023 11:48:09 -0800 (PST) Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-5c9d850a0dbso6658997b3.2 for <linux-kernel@vger.kernel.org>; Sun, 19 Nov 2023 11:48:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700423288; x=1701028088; darn=vger.kernel.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=Y9sAFqwPPdpUQXqbpYpZjJ/bJFuU5qndB3eaipJ94VTJIKWoYM50djbzA8SIXrJp0E IQB+DXITZVEmKmCwo/wFMp1N+qG6z0btZOGJVXKggy+SgcgidRpVGvdBG4xhV4FE7AkJ l4rixv+zfi2XOjZY8M7Z/7CO8AVI+XwvjCe6aBACRlKbXd72bHRyilUuKRc5lIYCDts1 8HNy+kHE3SV6ZJvDbF9sGSrswumW19xFIu7juY64z337qf3doIndP5V1a1OyCwmyU5sA PF5ITZ1VZkihNjhzdlLL6Df5ZWehP+u2rGd4pmS2P/flRVc9zWrd6aZlwiFW9dJQcnAQ +PUA== 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=Yj3eNh5jUBAYPYvV47npF8G3aojkyElxcmw0nAUeXqjHu5dzbTX2PMrdkcx8dIHSSa DQ0RoMYLhigpSvwDTto6btWVqAQu5aF1DNESgT9vPsnP+70h2E4pdZH0CJgkBE2M0WN3 ovdRVzX20sXBeKJd/zgJ95aZbOXKf2ETuzlYrNyIW1Znf8BM2T4mMSNsKpDSNDDEy874 cUNjRuizQH3mwx4GLTgWf9TgFuWRJ2BNrTTKx1W/WgTWarnrKQ0/x//JHMqXhf1eqjeb X7BHIz/pejB41bTRlSi9uKHxb+Xr95lsA9x7pvN8eYOXUqJ04jlO8a5+BEsoMzxqdtq4 itSw== X-Gm-Message-State: AOJu0YzS44t4sk1xM3JMDaCRHfjvwppsUbVPIeIer9h9MyGrUF+pRknw eq7Qc1mj36D36QQzv3rlvv0= 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 19 Nov 2023 11:48:21 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783023065284357869 X-GMAIL-MSGID: 1783023065284357869 |
Series |
Swapin path refactor for optimization and bugfix
|
|
Commit Message
Kairui Song
Nov. 19, 2023, 7:47 p.m. UTC
From: Kairui Song <kasong@tencent.com> Some useful comments were dropped in commit b56a2d8af914 ('mm: rid swapoff of quadratic complexity'), add them back. Signed-off-by: Kairui Song <kasong@tencent.com> --- mm/swapfile.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
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;