Message ID | 20240508224040.190469-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 85204C04FFE for <linux-mm@archiver.kernel.org>; Wed, 8 May 2024 22:42:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1275F6B009C; Wed, 8 May 2024 18:42:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D7796B009D; Wed, 8 May 2024 18:42:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE2A86B009E; Wed, 8 May 2024 18:42:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id CFA6A6B009C for <linux-mm@kvack.org>; Wed, 8 May 2024 18:42:22 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5ACDDC06FB for <linux-mm@kvack.org>; Wed, 8 May 2024 22:42:22 +0000 (UTC) X-FDA: 82096703724.10.0F5C438 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf23.hostedemail.com (Postfix) with ESMTP id 72FF8140014 for <linux-mm@kvack.org>; Wed, 8 May 2024 22:42:20 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=k3lnSQfq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.216.53 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=1715208140; 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=0eTHILZ80XouT+1m3vAPlwsDJfF9Pcan8u7a91N/lZo=; b=B9kq8SE35MTHg4X5hzaJjqNxJ6clJbux8q8DMmwZ2u6tD+RCBCHoI73KEnbSXWyUk7z9RN dNg7QKGO7GOU3pS2wWTrUeHNFdBq/lQQhKx5Qxxa+0awhAM+Erx0+OjC6YG8NT13Ftf9XY Af6d5XeaX7KLmKa7A1M00iwEvQITDcw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715208140; a=rsa-sha256; cv=none; b=rEDj0bpyGXPjsXMvU1zAxyE41TwxaO1uIIcYugetXXpcMtsRbqqU9eqs0nY1lA79ulAb28 AWDtTMEoezxiIISvxz+lOWAa2FuV8r+jsJLrOp4piJkEGxDenx/wZsOP/oBm77gw/GpY0e IswtLMBSNWqHlRTJyNqt1gzqdsxzZPs= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=k3lnSQfq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.216.53 as permitted sender) smtp.mailfrom=21cnbao@gmail.com Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2b33e342c03so286915a91.0 for <linux-mm@kvack.org>; Wed, 08 May 2024 15:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715208139; x=1715812939; 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=0eTHILZ80XouT+1m3vAPlwsDJfF9Pcan8u7a91N/lZo=; b=k3lnSQfq7sFi4IRtUF9QHAsY5a3Y3wNhEOlMTNdvxsmyOLGDjO+x5b465V6Zeo76ec oIwVTm9nF3DbJnnNDh1lh0xvRLFGUtisd5luWFj0Rvv0YV+zYqMiDw12XuQeEECx73OS Ul1ZGkUxa0+dNtRjXHbkQ5Y17D7gvI26qHb+/twyHACLiMoZR/UGDLfnx9yHSfVW8yeO fTE/vpDEHBa10NXBRd5LktDTbFE0kjmdccitIjsPqf8BqO9IUghfoF9eXNDOs/AfCQI1 kiZzqbUDy75jTvkOikUJO/WONmF5hhCkGl3ZdVa9WGNPy0zZ+ge4/GLeTol2iUaGobDc jPdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715208139; x=1715812939; 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=0eTHILZ80XouT+1m3vAPlwsDJfF9Pcan8u7a91N/lZo=; b=HL6km6QBNKyMN0+IfLtruiX+XBCzj9EJK4EtYv7tdy+zIGCM2SnZZOAvU9lgbvyAyD fJnoKI/ioBpHp3K+BDlvoP6UIotJ5BdfWMtPv8IvZcPFNfPTOaF5+apJTc6b4IaKOmfl Ts6gsrhYKMF00t9o/DlsyknFRQGvwRNuaMI/K+W+2zN/XYtz96PvVdzgcnki279cULy6 hv0bLStOe9ApxKXTecewyy322USbki1lQOlEqhOhtS+GDVB+3vpt5F6gAbZdnOLdNtNC ht25on/qB22600Dqu1UY28stvxa4SEsQyJA2RnNatw6ED9ZZVLSkCkkXesPrn4p5Lf0J 7yMA== X-Forwarded-Encrypted: i=1; AJvYcCXxrw0Irdr447XY6ZHAGl35I0mijLctcIlnX0+Fp4pbcbM+B4Qw0gMmOI+uDYyMr/q8SgNhMfErO64aFj8t2RUt5XM= X-Gm-Message-State: AOJu0YyU7oDWA0+B+taxeIwDeR22Xb9nOoUOYRoUHze3AUSZUIF/wyQR S8A/GqXd7NULgetkm6xPInEZi3qNtAhwKsqJ9/UzZfSthBAAzjNA X-Google-Smtp-Source: AGHT+IHz0/iZAnfRiaUeJgoYtdpHEy5GFxUrXuxrhikbMPcC7Bwle7yCU/X9SrLM3+bghWb9T3SB5w== X-Received: by 2002:a17:90a:ce94:b0:2b1:73f8:a013 with SMTP id 98e67ed59e1d1-2b61639d6b2mr3773903a91.2.1715208139383; Wed, 08 May 2024 15:42:19 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2b67126b666sm102082a91.34.2024.05.08.15.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 15:42:18 -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 v4 5/6] mm: swap: make should_try_to_free_swap() support large-folio Date: Thu, 9 May 2024 10:40:39 +1200 Message-Id: <20240508224040.190469-6-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240508224040.190469-1-21cnbao@gmail.com> References: <20240508224040.190469-1-21cnbao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 72FF8140014 X-Stat-Signature: 3o5ahji3cis6k77ou8qfhybrtkqrhwxx X-Rspam-User: X-HE-Tag: 1715208140-320540 X-HE-Meta: U2FsdGVkX1/Dc/1dtwGdn092QFGwGJxaSv7U4Umj/XyE+ntTOgiO/hAw5qHCW55VZkmP+WKqepR4qC5cEsxes5rYgps+W/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DgrNklN/mu4uLu2QLUKpXyJ377ZgAHSTQ9gkf/xKfZZyNyi1XOph+mKKsn8yHZXSHUSatMK7aixVlmoI4KqSiyriG2xGmgSVSOtj/nw0E/Jc4ldJLcYAb5mWk5evicF3drv51Thh6bhJE8qwLmFdUk5Mm3jzMxPjHE9ToB7VhHM04IO7Zyd79mdS8KTIgsWc31qcldW9joLR1coAO6CC9xhwaHyi8/N/PHO4UghxIM2WiZ2Blcru88ibB38Rbj1n4gW9rjNSB8SJK1IkLvxOk1Mk9dBYFZohNhGJ9AKbXCfZY6JXV61kTGzGdRQ3fmJ1XIcaqsn+pBGweO6hSHJGOJ77G677jv26kVm+qHv5FlyHgkWtb9eUEtd4t6F0fvGaPkGW5GXgkS+X8Mz3+LP0/kIaGpdpk5Q4HwUp/9GqejN0qNCzrs34Qa9qoxFdAJmLJwf1sQ0CxVkso0gWKsDQIu4DR0JtszFtP6YRw4C+D9hvgWJkp5Wx7MH9lVeSinjILjgrfLhPUSJON+fpB2+NxrZ90WjMuAMMbFrVPj9LGBs9ZgtNIAg= 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 |
large folios swap-in: handle refault cases first
|
expand
|
diff --git a/mm/memory.c b/mm/memory.c index b51c059af0b0..d9434df24d62 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)