Message ID | 20240118111036.72641-4-21cnbao@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-30038-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp267886dyb; Thu, 18 Jan 2024 03:15:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLZ/KtDioujlyj5TMRndV05rPSaw6E1skcw6wOInjdj0AOA5s1ltsIV/EBxtwcSfNtsZhH X-Received: by 2002:a05:6a20:da83:b0:19a:3f38:b180 with SMTP id iy3-20020a056a20da8300b0019a3f38b180mr776481pzb.31.1705576526540; Thu, 18 Jan 2024 03:15:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705576526; cv=pass; d=google.com; s=arc-20160816; b=ay+ZDbqxAFmX4SbDBn4Mq2K1hF5j6BlW585gt3a15QiGpHQPca2z9OmWg0VtAX+/7B FMNfF/5gCtzlRV/LuIVIYQW8RXMONmO9LC7oZYRPBpUx6GI8R6x86IC6U50JYuwS0/Mu VHo81oUfyNidMhkK2A1fh7/r9y97Jar+CMFyoDh0E0iJ1MHjfK3WI/RoObdEuOUOLmyE UCXGzykfJmQFoHyVjVp7HXLVXulU2RuQrb57XntOlNaf6baY3zhneCMzXtcejDqVnye6 Uv1Opnobozdt5xuLS4PXH3BzfVOx1Nelw62WAR7LC7jzSrvtHdH+ZdkkYe7asCevafyU DIuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xZZoI8vzJz6uaOc3IP6SaeIVpVjWcCgJVsn6AMZhjDQ=; fh=HoForU5yJzZ7+tbHNDgwWa4PuJoKilOkY6/CHbWKADs=; b=L3S+JKvxA56vxpOfvF2TH9gULbx2xDKf/K0lnJVZxrgE7CFGfwcw0Bs5XNCAUOR7Ci Bugv+m0JVBtqx5nmWizTgyMF83GjrKUgizcKKsqrHvz4IQe2G4Q/ZmYGw8KsFwnxdq5h Uo/DlTTc+I43nQC386mwVzQCYsFxMpTZ8yejL8ipBacqcuojTMCQFSatn9n7u+Uc2heW Butz2oClRw+cwwFzRpgvG57ZzFLY03zEURWlY3rX2RUWKx3wSwTYv8AuyTf8rNESe48d KR841ZcnmJbtn9GAwOvPiGcWH30R7Ksog/SODSqruhMYV75WLDV85a0vH3ilvxJXPSF5 VgQQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fjsLNuiI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-30038-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30038-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o12-20020a656a4c000000b005cde435ff91si1319724pgu.878.2024.01.18.03.15.26 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 03:15:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30038-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fjsLNuiI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-30038-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30038-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E9E6CB24FAC for <ouuuleilei@gmail.com>; Thu, 18 Jan 2024 11:13:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A34225550; Thu, 18 Jan 2024 11:11:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fjsLNuiI" Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D996250E1 for <linux-kernel@vger.kernel.org>; Thu, 18 Jan 2024 11:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705576309; cv=none; b=ab6PX7laIEaTjmXjWAhcqUczpDDqS2iNK+5kJ/gN07pXWh+pzUarCe82EmJwWpGz5T3JFYU7BfGgNX7FfbqPfcvgV5dYZHJ+wAIWr+wZHY8++oRvEHR7SW+1SLgeIvuYu5TrVYcbZng2yvuR7YLvuFlgtColXH9Gv6hw61Qvm28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705576309; c=relaxed/simple; bh=EqW7jc7DVH+vVsBXp8KOGtXAxEdSJsfQ40/OG3oOCrg=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received:From: To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; b=VTQBlpdumTZk82rwfYExWEdrR26MdQqscpE2Q6c1D7hcurOPiXUXQWq9QFbIAtoSw5kRG6BzxM3TAMjsJmS3PGw4lp+tqbe9CAStYM+1o9QZwJOonOLITn4ZCuKmX61NmWzjA3Up4Sqx5BXlC/eD8JIrw4DDZkjsVrsHqV7DjiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fjsLNuiI; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-5cd8667c59eso8475997a12.2 for <linux-kernel@vger.kernel.org>; Thu, 18 Jan 2024 03:11:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705576307; x=1706181107; darn=vger.kernel.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=xZZoI8vzJz6uaOc3IP6SaeIVpVjWcCgJVsn6AMZhjDQ=; b=fjsLNuiIdorbIqu6SnQ3DyJw7U7oLlq6K3NH8xkyvNr7EbUtKHLxKZtFPzQvQXk6ie hNYP56ku3FD4yacZGRyBYD0irVZGoVHkn4TwYQqtJjnpWAKCPstnvXtWpdZ2p//Myfrp O8VbdkPv6Qouo8pqUuj6u0Gr9JlEhxAjZWnI9OFfY+FDcnNRwV1K3WXrnubGfv8ZAEI6 8DdC2uTXJoZ4abzlinehG1UHztrrlfAz9vBTL2IowPeoyVbxfM/oKSTbSLVqyIl/APdd df+gzIJ10C4z+AN2a3tSs+/TlzWpP3/3+GGOEEfV+gsDHVHFnwknxoo36PoHcznk7Md2 3oKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705576307; x=1706181107; 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=xZZoI8vzJz6uaOc3IP6SaeIVpVjWcCgJVsn6AMZhjDQ=; b=ug8NfpIWSBO+Hc+Saq/YovAwY4YnecIiXYQyRdOXs+cuAUFWzWEumZgEMZWA1wQcy+ qsoqn51UM/jNKA5nR4NwBKM6972cjk0a+62sJazbo4/Pb2ys8bSVBwYq+qAyYjvwUXV4 GYLk3byj83AkQmQCVV72w/TiCh+IP3cWXDMRDDOJDgyKwijIb90rAENvO56AnKc6d0Mj /awFMa2R2R5ldkFTRo3/4BZbhkz6AnQ+mgWojWv8sEKggavr7av9HevJDl0/gPrrY9ig h06mGSU4gC26C6bmWLIca52oHjtk+iTKyjcDDAy0FtaIoYPLUvSEpzhAR9jbyiUDGe5R vZzw== X-Gm-Message-State: AOJu0YyLEGfPdKTvg8qdtue8jR76/J+r+IO0OvUMrCmHHylq3mT8VlUW 5V6o18qj9JqZP8CLzOzCRP2KZl4gNZEU/hozkWxvbfWoq0uBs9AJ X-Received: by 2002:a05:6a20:9f9b:b0:199:e4ab:691c with SMTP id mm27-20020a056a209f9b00b00199e4ab691cmr731200pzb.8.1705576307486; Thu, 18 Jan 2024 03:11:47 -0800 (PST) Received: from barry-desktop.. (143.122.224.49.dyn.cust.vf.net.nz. [49.224.122.143]) by smtp.gmail.com with ESMTPSA id t19-20020a056a0021d300b006d9be753ac7sm3039107pfj.108.2024.01.18.03.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 03:11:47 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: ryan.roberts@arm.com, akpm@linux-foundation.org, david@redhat.com, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, mhocko@suse.com, shy828301@gmail.com, wangkefeng.wang@huawei.com, willy@infradead.org, xiang@kernel.org, ying.huang@intel.com, yuzhao@google.com, surenb@google.com, steven.price@arm.com, Chuanhua Han <hanchuanhua@oppo.com>, Barry Song <v-songbaohua@oppo.com> Subject: [PATCH RFC 3/6] mm: swap: make should_try_to_free_swap() support large-folio Date: Fri, 19 Jan 2024 00:10:33 +1300 Message-Id: <20240118111036.72641-4-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240118111036.72641-1-21cnbao@gmail.com> References: <20231025144546.577640-1-ryan.roberts@arm.com> <20240118111036.72641-1-21cnbao@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788426611847056426 X-GMAIL-MSGID: 1788426611847056426 |
Series |
mm: support large folios swap-in
|
|
Commit Message
Barry Song
Jan. 18, 2024, 11:10 a.m. UTC
From: Chuanhua Han <hanchuanhua@oppo.com> should_try_to_free_swap() works with an assumption that swap-in is always done at normal page granularity, aka, folio_nr_pages = 1. To support large folio swap-in, this patch removes the assumption. Signed-off-by: Chuanhua Han <hanchuanhua@oppo.com> Co-developed-by: Barry Song <v-songbaohua@oppo.com> Signed-off-by: Barry Song <v-songbaohua@oppo.com> --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Acked-by: Chris Li <chrisl@kernel.org> Chris On Thu, Jan 18, 2024 at 3:11 AM Barry Song <21cnbao@gmail.com> wrote: > > From: Chuanhua Han <hanchuanhua@oppo.com> > > should_try_to_free_swap() works with an assumption that swap-in is always done > at normal page granularity, aka, folio_nr_pages = 1. To support large folio > swap-in, this patch removes the assumption. > > Signed-off-by: Chuanhua Han <hanchuanhua@oppo.com> > Co-developed-by: Barry Song <v-songbaohua@oppo.com> > Signed-off-by: Barry Song <v-songbaohua@oppo.com> > --- > mm/memory.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memory.c b/mm/memory.c > index 7e1f4849463a..f61a48929ba7 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3714,7 +3714,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) > -- > 2.34.1 > >
diff --git a/mm/memory.c b/mm/memory.c index 7e1f4849463a..f61a48929ba7 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3714,7 +3714,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)