Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp408282rdb; Mon, 15 Jan 2024 00:48:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2pbI9G36anTIxMVFE1YKBVDvFtK+4v5saLYK8b4WmoXz5oNfUY5PiOFgDKUPFX7ra5vIB X-Received: by 2002:a17:906:9c87:b0:a2c:11f4:d578 with SMTP id fj7-20020a1709069c8700b00a2c11f4d578mr1810675ejc.11.1705308525783; Mon, 15 Jan 2024 00:48:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705308525; cv=none; d=google.com; s=arc-20160816; b=hXO1uBksBBaM3wo6D9yRHaWeXJr/O3uh0o65k0U5iatZHDo1MOCNm43eAJYeY9QRH5 e3JQAx3jiXWx5ghZ/I3LGg7dOyqv8+Z0gr2LZ6ZbqjO/efgrDQ/gseSyAZDpMURh1CDE fYuHUqRNKQfystyvx6mE5UjxrkcJPEVQfYCs4mL983MzViejBtgWgoVeCd3oImLyM4cc kigXFABC8Nbje7RndoK/VRLzj3xfktm5KinzQ838EKcOcIFYDn/k0s9LI3qpNEsFTMlM MwCSH/PYhpgNGnNpsqK1nF3IaOLqCyuGAyqgDOk+WXzpGvnWFSUZhQO9l0SwlHWVVJWJ yRNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=OK5RPdEJam8vmvoTngF6GKblarmkfeKuX/seAdwKmhU=; fh=GLUtNoGkf2YWdw6rYn5sLcedR6TRfK9mXlUAaKh+EHQ=; b=GbjCqOY1VmRM/fovA6bJb4XAwQHmn9kcAjozp6Onz8jV6yAuRKr042ChwOtHGYqPzL YXW5xUCjBf9wETmyRKR4tOeDO+D64+9E6eQ04QmqhG2Kw4OKfmZ//LgEAMECQF2vMvAc er75fodX8AsbNctdSZLa/UGCdDQL8hA9LT9BzxNuDDIjP7ybBcL5qdjlCmrO4hV7rVXs E/+rCW1hl2mQfvZ6LdJBg9M05LJ0CFA8lIurtbqCssi4WMeqhB/u2twJfx4/MRyuo1E5 SpW1EvDltGVdUwwjmEhpsKXoipMmxqw9MjPTGfh+YCvNsd4cvcgy1LHPZTteJOy1EIX8 YyVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25750-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qu20-20020a170907111400b00a2ba373df06si3600340ejb.557.2024.01.15.00.48.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 00:48:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25750-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5768C1F21AE5 for ; Mon, 15 Jan 2024 08:48:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C58CEBE73; Mon, 15 Jan 2024 08:48:37 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 105CE8839 for ; Mon, 15 Jan 2024 08:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d85ff70000001748-f9-65a4f15eecc3 Date: Mon, 15 Jan 2024 17:48:25 +0900 From: Byungchul Park To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, akpm@linux-foundation.org, ying.huang@intel.com, namit@vmware.com, xhao@linux.alibaba.com, mgorman@techsingularity.net, hughd@google.com, david@redhat.com, peterz@infradead.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com Subject: Re: [v5 4/7] mm: Separate move/undo doing on folio list from migrate_pages_batch() Message-ID: <20240115084825.GA18164@system.software.com> References: <20240111060757.13563-1-byungchul@sk.com> <20240111060757.13563-5-byungchul@sk.com> <20240115020817.GA56966@system.software.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240115020817.GA56966@system.software.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFIsWRmVeSWpSXmKPExsXC9ZZnoW7cxyWpBuc75C3mrF/DZvF5wz82 ixcb2hktvq7/xWzx9FMfi8XlXXPYLO6t+c9qcX7XWlaLHUv3MVlcOrCAyeL6roeMFsd7DzBZ bN40ldni9w+gujlTrCxOzprM4iDg8b21j8VjwaZSj80rtDwW73nJ5LFpVSebx6ZPk9g93p07 x+5xYsZvFo+dDy095p0M9Hi/7yqbx9Zfdh6fN8l5vJv/li2AL4rLJiU1J7MstUjfLoEro3tW J3vBVZ6KjXMPMjUwvuHsYuTkkBAwkbh/pI21i5E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wClhJdSx6ClYsKKEsc2HacaQIj 7ywk3bOQdM9C6F7AyLyKUSQzryw3MTPHVK84O6MyL7NCLzk/dxMjMKKW1f6ZuIPxy2X3Q4wC HIxKPLw//i5OFWJNLCuuzD3EKMHBrCTCW31nSaoQb0piZVVqUX58UWlOavEhRmkOFiVxXq/w 1AQhgfTEktTs1NSC1CKYLBMHp1QD45S1TbO4Mv0y9tQWCbEVlm29Iul6QuHjCofPgqum2GT0 hJY/TFz1slKw23Uj47+HZwpVosQqJA8lbNIt1bAp8gusWvHQzkXsb73t8gS+B6rP9R9UBUvv PTF1fXFceZ7XweylE6b5PnJ6uX1e9nID/fxNYaIbjv23z/T8mfY0vH5PhVFnqF61EktxRqKh FnNRcSIA72GZCKQCAAA= X-CFilter-Loop: Reflected On Mon, Jan 15, 2024 at 11:08:18AM +0900, Byungchul Park wrote: > On Thu, Jan 11, 2024 at 03:42:55PM +0000, Matthew Wilcox wrote: > > On Thu, Jan 11, 2024 at 03:07:54PM +0900, Byungchul Park wrote: > > > +static void migrate_folios_move(struct list_head *src_folios, > > > + struct list_head *dst_folios, > > > + free_folio_t put_new_folio, unsigned long private, > > > + enum migrate_mode mode, int reason, > > > + struct list_head *ret_folios, > > > + struct migrate_pages_stats *stats, > > > + int *retry, int *thp_retry, int *nr_failed, > > > + int *nr_retry_pages) > > > +{ > > > + struct folio *folio, *folio2, *dst, *dst2; > > > + bool is_thp; > > > + int nr_pages; > > > + int rc; > > > + > > > + dst = list_first_entry(dst_folios, struct folio, lru); > > > + dst2 = list_next_entry(dst, lru); > > > + list_for_each_entry_safe(folio, folio2, src_folios, lru) { > > > + is_thp = folio_test_large(folio) && folio_test_pmd_mappable(folio); JFYI, in the v4 patch set, I hadn't changed the original code that I refactored. I just copied and pasted this part from the original code. > > > > You don't need to call folio_test_large() first. folio_order() includes > > a call to test_large() so it can return 0. > > > > > + nr_pages = folio_nr_pages(folio); > > > > ... or since you're calculating this anyway, > > > > is_thp = nr_pages >= HPAGE_PMD_NR I didn't apply what you suggested me here to the next version yet because I was not sure if it'd make the code more readable. Thanks anyway! Byungchul > Cool. Thanks. > > Byungchul > > > perhaps