Message ID | 20240102175338.62012-2-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 70FECC46CD2 for <linux-mm@archiver.kernel.org>; Tue, 2 Jan 2024 17:54:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1366E6B0087; Tue, 2 Jan 2024 12:54:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0E8196B00A9; Tue, 2 Jan 2024 12:54:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E7AEE6B0087; Tue, 2 Jan 2024 12:53:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D0B946B0081 for <linux-mm@kvack.org>; Tue, 2 Jan 2024 12:53:59 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A5F4C1C1024 for <linux-mm@kvack.org>; Tue, 2 Jan 2024 17:53:59 +0000 (UTC) X-FDA: 81635119398.07.1EF73EB Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf15.hostedemail.com (Postfix) with ESMTP id BDE82A001A for <linux-mm@kvack.org>; Tue, 2 Jan 2024 17:53:57 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hMoaZ1W1; spf=pass (imf15.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704218037; 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=HOgiTUumllZGmGcBS/5D1WFbQ4vDZwA6J8hbWSvm0VQ=; b=7f02MEcw238tlpmwbPf3RR8nfY7bq2YCqPIUPeBilgkMXx3/R86QbspXSAVlGYloWWkO/R 515dBY9/Kn8mxRPA2TKVWNaUOo3mRsw5X8eWJRs/YYmjdcDPSSzSWDc7yXCszFrAJVvL08 la9N8NmVm2mbdf8IP9E1z+GhTR9TJQw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704218037; a=rsa-sha256; cv=none; b=y2ZlM2RDlMoVM1JzBG9HZh2I1yAMIUSboOsF4iReM84H81SZAFHzBcIBNimeREUQE18jRk HyrsFy6MButeVu6ffnv2KugBufsjd47WbO4bZ6jqyHm3U5VqQv9stWKeXuISqsrOYHVg9X sN1y7n8hWkOnnm/0pb4hd14/9Cuo6GI= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hMoaZ1W1; spf=pass (imf15.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d3e6c86868so74364545ad.1 for <linux-mm@kvack.org>; Tue, 02 Jan 2024 09:53:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704218035; x=1704822835; 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=HOgiTUumllZGmGcBS/5D1WFbQ4vDZwA6J8hbWSvm0VQ=; b=hMoaZ1W1w7JlMOnzSmZHLaVEEerIzQ/Gv1jAl4OeQPV52ZSpftG7XpFGSGgClVojkq 9XO7kzr2iBvVu6BhbsdHg5eV2l1iMAwaRioyawL8SsJEYFbjO6Dc22GnDNU53d9REVFw cUDYYyZELe1DVhOrxPrj2KeR04CHxr4OeEHoHg5waJqi0eAcl+PLgjzjZXpjsFPKFJTQ d4kcsD0+2y2jbjJJCdhLXgCllgWCbY8pO7H6QfL9AZzDyXKnIAV08Cy18B5Y9OlE9XhO xfJSxSCp3GUSrY6wsXmTgEX+rqi+35tvJSEjc+rM2XOm/wqoHXNgDG7sqMB2GhoeybwS 2E4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704218035; x=1704822835; 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=HOgiTUumllZGmGcBS/5D1WFbQ4vDZwA6J8hbWSvm0VQ=; b=vNrkCbWlDdH3+DZ1Tmy/kjRyBZVZ41bkLwRUAc1XaCK96Lt2PNAk6YRBJT5e+QsPGM rg/8RLITLymj3cNCU6mXc+PWQkxg/M0nsR+4drPBzL/2uXyvxl+YN/VfgY3ThJ4S95v3 7BpuSdCJy4vn2kFnAQqKFa7InhUTicKY/tHB2WVBvU1BGBEWiLNEE9bd03225s/v1L2S 2lsore7IObtKg6wKA6WCzeBu14PIspYobKzZt9cxs+NVEJ2v0LIHzSSob90iBACizpgW ygCf3C0IIy7aaA3WwtxTuOLhhwYv/b+6OSXyiTETiTuw9ZKkcCM6oQbRfrarvI5vWKcI cnYw== X-Gm-Message-State: AOJu0Ywt02wi74aokwgKKnApg7MDMtvV0YK6b9IDqAfxMW9OCs23rDnJ uS90CplWds4dlamoGO1XvOKPRHKSPkNAJr81 X-Google-Smtp-Source: AGHT+IE9UyXqSDCkq4STavfMkchWm/4gFSM+hqb3udvJPylkrwaXHIW+zWlXliWIUXub6vHeHy9JRA== X-Received: by 2002:a17:902:c409:b0:1d4:cca4:7e81 with SMTP id k9-20020a170902c40900b001d4cca47e81mr724379plk.64.1704218035614; Tue, 02 Jan 2024 09:53:55 -0800 (PST) Received: from KASONG-MB2.tencent.com ([115.171.41.9]) by smtp.gmail.com with ESMTPSA id be10-20020a170902aa0a00b001d3c3d486bfsm22151969plb.163.2024.01.02.09.53.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Jan 2024 09:53:55 -0800 (PST) From: Kairui Song <ryncsn@gmail.com> To: linux-mm@kvack.org Cc: Andrew Morton <akpm@linux-foundation.org>, Chris Li <chrisl@kernel.org>, "Huang, Ying" <ying.huang@intel.com>, Hugh Dickins <hughd@google.com>, Johannes Weiner <hannes@cmpxchg.org>, Matthew Wilcox <willy@infradead.org>, Michal Hocko <mhocko@suse.com>, Yosry Ahmed <yosryahmed@google.com>, David Hildenbrand <david@redhat.com>, linux-kernel@vger.kernel.org, Kairui Song <kasong@tencent.com> Subject: [PATCH v2 1/9] mm/swapfile.c: add back some comment Date: Wed, 3 Jan 2024 01:53:30 +0800 Message-ID: <20240102175338.62012-2-ryncsn@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102175338.62012-1-ryncsn@gmail.com> References: <20240102175338.62012-1-ryncsn@gmail.com> Reply-To: Kairui Song <kasong@tencent.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BDE82A001A X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: apbzdsp7ok7jhw8c4mumcop3tggps3w4 X-HE-Tag: 1704218037-950747 X-HE-Meta: U2FsdGVkX18PKKHdYAYwiFJzRvCagMXEoX4rexb6g3iKO8vLnWtwtTBeHKwZ1bvyi1xh7+PyqkQtxAQUHIIhvEa2e8KiEL3rbrAmpKgQ9Etn6d8Qk7LJs142MaUBz11qOvfhzv2GP17eg7ArK9BWCcCdVVQcIAP+NAAG+Y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c7j/H2Y74oDhIpSQ814KZ2IBLjBtY5nuEExdKZW90G0XW5YMW6zX7ALMdb9ykH+M+q3zLfyw/KhHLIfF76vLVgCzIz2IR2s6K0zq1WxkpTLY+LE4GhLSqfc8Z5FW2sCs8JpGu4xvGNoU4g6+/2hNaCQjliEVhdyxQM5TdqXkO2aaGsZ+TK2WocSVMuj9TD8wOEy4+CJIiRHI0mFzOrtY0tujnvmtGKszlB4Axu0TmsEl/a8udm0kzPSf78ATz6flKfDtbEcclxUX1SK0jl7m0ft2XmcbiL+9hOQKNeO8vfaMyD3lcLl6+y004OGTN+CohUCnXWCWfsNFGV/Qo9tuk4ndxP3LwE/U2l75p5ohatGwrPvVQ2JSrlqOMu9Ord5vMFzvE8b+phUgdzcdK 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 refactor for optimization and unified readahead
|
expand
|
diff --git a/mm/swapfile.c b/mm/swapfile.c index 3eec686484ef..f7271504aa0a 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1880,6 +1880,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;