Message ID | 20240503005023.174597-6-21cnbao@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 CEED8C4345F for <linux-mm@archiver.kernel.org>; Fri, 3 May 2024 00:51:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D7146B009A; Thu, 2 May 2024 20:51:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 586536B009B; Thu, 2 May 2024 20:51:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 427B86B009C; Thu, 2 May 2024 20:51:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1FFDB6B009A for <linux-mm@kvack.org>; Thu, 2 May 2024 20:51:23 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 969CE12084E for <linux-mm@kvack.org>; Fri, 3 May 2024 00:51:22 +0000 (UTC) X-FDA: 82075256004.27.F379510 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf30.hostedemail.com (Postfix) with ESMTP id BFA5080003 for <linux-mm@kvack.org>; Fri, 3 May 2024 00:51:20 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Zww9Db46; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714697480; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Y50dQl+upnub8ly1QPHs/qiP8XcDN3yKo0FUp2Qgag8=; b=8k0e/QFh4RF50/PnKn7zdGwtMu1j6YZuiNqcquyxcHAjfS+gmgndbl9bi1wEJ9OzZ+DP26 9WNpobYC60b1qxoLxiNLuAtaRJDhXOgaHAF7r+faktEUUrxD8jNfndAFflRe/9DFHmCZ5E r4RqFTfsiKTn5rtwHRyDvFJ4wnqaUEw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714697480; a=rsa-sha256; cv=none; b=qWjTdOsp/gp+8q8yG2KOrBlLd9grxZ4e/6nAsZXHJB6//udRQRefeI2JWhIs5EDAIIy8i/ iqDUtTfOqV0kzuu2SBgyWaJ826KnZzGL65RLThkaF/v0Xi2vU1Oa1DpXNik2MxVTdNPwii b2Nz5SRhCk/AXgIhPV8tumGnYwULFVE= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Zww9Db46; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=21cnbao@gmail.com Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1ecff927a45so10984815ad.0 for <linux-mm@kvack.org>; Thu, 02 May 2024 17:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714697480; x=1715302280; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y50dQl+upnub8ly1QPHs/qiP8XcDN3yKo0FUp2Qgag8=; b=Zww9Db46ckUe5YW/Eiu3Eo/Arwewm6tP5cdb/63AWgbOoyMQJXxClaYEUMNXz/qwhR XJjCgikKkw4n5+HcICnSdH1k3iUW/vp95X9T06FWnnG0WeaAV5jTjIOZAG33UC3nZ/Kj 8R8p08G/R4zkKgu4dHnR0Nf/2W76xzSlh8MmejmVCsYVrmCUZDbpXbndOeqaodbZn/7a GQu/bEO9lXg61UAo80fhp9ovoqekEF3AvDdQjabmBW/IMSsiUd6FWddob3Rp502lTVGz rDUL+9mzn0WOGKxrprWoCmGmkSU8nX1c1K/+rVJ81Yt540ymKY8uf80XLatMCUHMQHfC 9EqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714697480; x=1715302280; h=content-transfer-encoding:mime-version: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=Y50dQl+upnub8ly1QPHs/qiP8XcDN3yKo0FUp2Qgag8=; b=o0gw2lK9Vpdu9RbzunFrwcg1lCqptgRzmBrA8SpGGcHO42CXvLpXa0Ep/Bus4WwtwJ ozGs+L2wOxxeZpL5z15rCBKqNXtSxm93Vj/tKWq1t2QlTI0qvjm54bvlxGyo0Ly9bK8E d/lxEzCneFgpeZdYl3EFwYR+Vejt6LANHkyT+EuarttGn6wH11EYe8/7jAfDU0v8bLgq dzD/gf0CKR/Ry8vGhhuDS5tnLucOZPkpLLJtSxyzGWHvHrqI9wi7h8tnRnZGfOqolrgc 0l00QjB9JPtWmPZ8kk3DjIX4Gh952N8zeJIKnAnlk1onyc2NJ5Fol9xnwn1hJkFJyqrp Zb5Q== X-Forwarded-Encrypted: i=1; AJvYcCUkQLb4QieewjPwLdksI+qWiFH3KdIxIy1RT5xvZ2X8icG5U1Vc8cX1QggR6nPl2u+CunBaZ0aAvsjv3+Pfeor5APY= X-Gm-Message-State: AOJu0YxfMGpeG6KxxptC0mk2yxDioawy74EaNZRcXNTso5SCIavs4M39 /HV/QX8yBrI+aamKQ7qlaxcTD0HRGRaBJVSFNybMv1H0YUeygycy X-Google-Smtp-Source: AGHT+IF/YGckt6lCQLRiwu1+5wNzKcMLcZACnvpyDGbcY6XjGmdPdZXMo8MwxWmuAEpW19MZtkC8pA== X-Received: by 2002:a17:902:ce8b:b0:1e4:362b:17d5 with SMTP id f11-20020a170902ce8b00b001e4362b17d5mr1757897plg.4.1714697479694; Thu, 02 May 2024 17:51:19 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id d14-20020a170903230e00b001ec48e41d2esm1969175plh.212.2024.05.02.17.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 17:51:19 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: baolin.wang@linux.alibaba.com, chrisl@kernel.org, david@redhat.com, hanchuanhua@oppo.com, hannes@cmpxchg.org, hughd@google.com, kasong@tencent.com, linux-kernel@vger.kernel.org, ryan.roberts@arm.com, surenb@google.com, v-songbaohua@oppo.com, willy@infradead.org, xiang@kernel.org, ying.huang@intel.com, yosryahmed@google.com, yuzhao@google.com, ziy@nvidia.com Subject: [PATCH v3 5/6] mm: swap: make should_try_to_free_swap() support large-folio Date: Fri, 3 May 2024 12:50:22 +1200 Message-Id: <20240503005023.174597-6-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240503005023.174597-1-21cnbao@gmail.com> References: <20240503005023.174597-1-21cnbao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: BFA5080003 X-Stat-Signature: 9ju6c7kwgnf3m3hccwrnh1thwta8ihpg X-Rspam-User: X-HE-Tag: 1714697480-68983 X-HE-Meta: U2FsdGVkX19Lz5ssjOrN0AT7fJoN59DCaiR6urmx6Bn5OGIvWCrpQcaf+Fogm88IlNKvDCfXG+4BxEVw+mETt01WO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vZ/VJN5iVrq0CJTl0RUk4ftiaNDlolkeP6tTFuxCPFuZxdadVxYGfl6Y4mQATRD4nQlNTCEAX2eE+BFsYNt+iWz8Fi8X+GQ2if59cgYJ3b+kdW8zLsqmxgc2+zyiEqGP6CtrbBO49CJnLeGeQ2/+ayG1Wi+PfpgC/XnyPRtYarxw6j9yF6LT14IYYk8WPslSXIQpJmtrMwpgRnxAmnltEdvsRgeVMCA+6m4oBoUMitZt9pdUYo0mRmLcfbXBTwYsh8DpH0+/+qp+Y9j91sPAL7+MMkq1ese3GDLdTB9ZGdtVZnl9x0kZgh1m9v5ZzOeY8GK/TCfeIFh6H6Q4w/NruhNhzMqAB2BR/X/udsDR04evEVWvvh5qEtQLPYxdLmqZ+IUcYjhQArk4WgNoZXDGETrlpWJeumBzGlUY7KxuIR/XUreMh4Soodhi+9NgiZWIZkWNkzAmRX8xAkKwhj8DULeTPffsYGnMXuHu3bocsI7a/oJB4WWCgKErcIqfuvduxavJ2IxByyNhQq8zd+EGQ6mOx/dMKR1SQLMBrKjB4eiio4TCwg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, 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 |
large folios swap-in: handle refault cases first
|
expand
|
diff --git a/mm/memory.c b/mm/memory.c index 74cdefd58f5f..22e7c33cc747 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3877,7 +3877,7 @@ static inline bool should_try_to_free_swap(struct folio *folio, * reference only in case it's likely that we'll be the exlusive user. */ return (fault_flags & FAULT_FLAG_WRITE) && !folio_test_ksm(folio) && - folio_ref_count(folio) == 2; + folio_ref_count(folio) == (1 + folio_nr_pages(folio)); } static vm_fault_t pte_marker_clear(struct vm_fault *vmf)