Message ID | 20240529082824.150954-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 360FAC41513 for <linux-mm@archiver.kernel.org>; Wed, 29 May 2024 08:29:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A325F6B00A7; Wed, 29 May 2024 04:29:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9B9706B00A9; Wed, 29 May 2024 04:29:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E4DA6B00AA; Wed, 29 May 2024 04:29:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5B6936B00A7 for <linux-mm@kvack.org>; Wed, 29 May 2024 04:29:25 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CDD08A180C for <linux-mm@kvack.org>; Wed, 29 May 2024 08:29:24 +0000 (UTC) X-FDA: 82170759048.18.5400DA1 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) by imf29.hostedemail.com (Postfix) with ESMTP id 1012C120003 for <linux-mm@kvack.org>; Wed, 29 May 2024 08:29:22 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=e4GomEHM; spf=pass (imf29.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.49 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716971363; a=rsa-sha256; cv=none; b=4KeNbIgaEITNC4UEkVC/coQy4UdDlkuO6HXd65ootCeKvvMxxYbmGsRCSPTbFgg/PeADm1 nD0ljk+QwMuVS5HcmCqPsiPnb81EuBZ0Nv5aNHODXuen9cG8rsqPheQH2++P2R7uyuODx1 DS0SzqW2X91y+KJdlRxj/Ucr3yBfOfg= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=e4GomEHM; spf=pass (imf29.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.49 as permitted sender) smtp.mailfrom=21cnbao@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=1716971363; 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=6+4WZx2jk6Uy8Ser1SPRLQ9xpkk5S7WupCS1+ZFnTlU=; b=OPaEGWBqIijyJaY+02PpVnr3jNWgApjRQMrlxNMdp970Gr7Min5CWbVgNV5M/9UATozbeC QCql8fjs2gIxAdE01orxnXoJ94nq/X74AK8GbdXmLf1nspdF6W8VyfCMecB1Xg8dGHZWX2 Yo/hPa2ptXQrj36NcS6bOaRrwJ+vkC8= Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6f8ef63714cso1115385a34.1 for <linux-mm@kvack.org>; Wed, 29 May 2024 01:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716971362; x=1717576162; 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=6+4WZx2jk6Uy8Ser1SPRLQ9xpkk5S7WupCS1+ZFnTlU=; b=e4GomEHMSfoM5GCvxrCsOj8frjXebO0h1IeIFQGQqXjPB++sNpJCcQUk7bAtNTHAGO jrGAe6xKDyi/91Z5M+yaG/GxMCiA2Et6Bcxt5G/QQaRUBc/2V0480x/CFDcqBZpQz3SP 79YMjJONdH82o7Vr18+RmeZSyts1CPG94vuKffWHkmZ+OqndicjMPMNEL1jK3xFTsYNs odTyOlE6yenHMIyeT+gLrIV9+Q3HKDPnOsr3L3oO9J4oLQwm7zcNX1KzFpe3T6nOqSge OBq3LBgb+1LJXI3Gkqw1Lqg16Yz7meZK8aNpLGTpELaYzfsvmhbGELAzMEofcZLui8+1 stAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716971362; x=1717576162; 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=6+4WZx2jk6Uy8Ser1SPRLQ9xpkk5S7WupCS1+ZFnTlU=; b=NLp0gNLhnG8t+hSxrxsc0BH2an7YE6ZWKfl37YU+bFbBnldINBie+F7rknPL7YdPMA UKQfzD/PBauQllv67JgAljRAGrlepmfHhZK9sGgyy6ldccGkSCcIzDyQTw40Sf47fmwE 7aGQ5wGGBrCDooaBBbsG4rf+EdrooxbwEAyz/BJLenvJTn7kxguO4eptcGCxBn7mLtLd u87YnwZr9ZAoJ5feH8rT92igqsT8XWJAxFTfTssovDkewGifJhAz4RP+1MENJE2Ij7qk yd4iLOloRS9GWyBNc/zyRvkQMmeFZ7lHlg9HJpitZBmOqxjlRDDpm6RCn1uj+sYJ/B26 WdcA== X-Forwarded-Encrypted: i=1; AJvYcCWTHK/0bY6AcJkwJAAWORnocFqwHH00gf20dOorc3Ruj3YQBIxiLF0A1fmZ2Zf5FhBrKDAg5sPSzY9uD5tcylUp1T4= X-Gm-Message-State: AOJu0YyHr/4GszqYikxYMXtJBvsW9XKEZZ+nkpef1HkK448GSb/XDBu9 L039GD8+tkxUwSkGGWUpXLvplk22onyzjt+3ZsigOLJelmbeMVOh X-Google-Smtp-Source: AGHT+IHGb+sXIn68+MgGWVaSAFwEZ1WhY2usjFaXYWxY+vdoWKkWciGEogVMz08VfHXPwQpQdXzQOQ== X-Received: by 2002:a05:6870:d6a2:b0:24f:e000:a6f8 with SMTP id 586e51a60fabf-24fe000ac34mr13014665fac.41.1716971361783; Wed, 29 May 2024 01:29:21 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-702220d948bsm174916b3a.131.2024.05.29.01.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 01:29:21 -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 v5 5/6] mm: swap: make should_try_to_free_swap() support large-folio Date: Wed, 29 May 2024 20:28:23 +1200 Message-Id: <20240529082824.150954-6-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240529082824.150954-1-21cnbao@gmail.com> References: <20240529082824.150954-1-21cnbao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1012C120003 X-Stat-Signature: uutkwxws1urczwfgs6hrbkrqtj1ebi5u X-HE-Tag: 1716971362-190664 X-HE-Meta: U2FsdGVkX1/0vMvHBE/BTWph0zksCP2rMJv0xSQbJrHLSlCvCEx7zSXGHJDrXjXjsnAnaPtGIfH/LSqY27Q4WAoDs7gr2E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Tt7Z0e4cuTyR1dLmSbTu+sVvfAl6UEwkzuuFvLq+1yxzIl4dM0vbI/EYy0tDQfr24hGbpAoa+b696sJBMo9/yLi/U71kkb7k1tuc5N2kEWm68I00x3IVdAhl8Nr2qulEt//c5ihfN3CVl4VvPuOi2ZwViJqUDLEPt0hPTHVwuJ0nbbaLrTjSPDe7FgsUhTrt/Uq3KB4NGVeBB7M2h5xXipH5WX3aKjmqUrTZGxWAFq4GgQtGHdzCJUD+0gWSzXM2mdQ5GF0Eu0+1zHMTKtbWTF41vYdG4H2LaigQ53pMaJEhVSNaRnyMsrvudv75hkz2fLQUIwAcrpxXrkJ7/lD03CRjGCzBW9MrzvCCuQFPamBKIIoSvhma3jkLYdvNlk7LLzE4XcafLQfoufjatoSv4da8kqVl7yJ0Xve4w1T2GQIz/iCSwxZj4X0l1h62btNsmViDtb2eLfdoo3793226PehExCrR3EpTLoi8L/YtMU9jSjgft5yC73BAo88bXgxIadlf8EIzipIqjNrHukVU794c45myAd3b61dQGu8TlrYpI7qY6q14JywRfW7/D7BsrbTLTTPoECXg= 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 c0c6de31a313..10719e5afecb 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3925,7 +3925,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)