Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp292614rdb; Sun, 14 Jan 2024 18:08:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbUywSO/BQjyEWM/s0obH8UV7Ex61XhbN7QtsBfrOQTESrI3sXDnLg4TR/luuYBmZ80q2a X-Received: by 2002:a17:90a:d808:b0:28e:778:a6bc with SMTP id a8-20020a17090ad80800b0028e0778a6bcmr1565015pjv.53.1705284529361; Sun, 14 Jan 2024 18:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705284529; cv=none; d=google.com; s=arc-20160816; b=X991mAVH/9x7UEmkLKPoOS67vYl+LTaRAvS/S37lR3kDCuvDDt9/LGV5t7sMTzd3lZ Si1Przcg/KZegAlUUS2c9UpECEbzu6XHuk1OX7t16N08sQQpIGmfnspoN4XTGBZlotDA 6JwGYIpcDiwt8nWC+U/7YY6kUiI/yUowfedZVaHDwBFMSHiD/K06dMe/mHPNHl7NtBxN nMPTpmHb5PPR8a3cJlS8nCSD36u7+prAjAnLrKSgVBBCygtmObyYPT4uA1batLu6nPcx QLfFXNiChleex5eIBZ3j1E+YB7rGXVCbr8XwHbVCehrrxrkeIqA05XEl8GjVdPt59fLK E+0w== 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=nPY0qYYVanxqiYvM7J1BKrG1YclVwJ1djZ1V+97DKkQ=; fh=GLUtNoGkf2YWdw6rYn5sLcedR6TRfK9mXlUAaKh+EHQ=; b=EZXfs33rI8PX085FGiRZI5lG8YYXX8Z2D8Kczx125BkmO6Uby9KTox2YvwxJnqIRM7 wJzbN5lUHAPUMLpJ3TRnBHiay8Qd3V04DgpwZ5+9qdum3prkjToyqjcnxsgJMvHHmYuq ngY7DorxAMLEat8Y2uGssaSQWecXHqm/u2cG1qVjl+1J25FocK3kDYmZfHsnM8BkTvAy wrOZJRyr8xVvzl2DvhQMUUr+MNqNFTYJctwb0cxX5VeT9M9HMerauCbDkZW55k3SMClS eD8a0lrhISPaaINCZg4lextNVYhBEKgb15FwGf1rHGNARC6aluq1aeihaoBqnt/jxQHQ TEjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25588-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25588-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bk21-20020a17090b081500b0028d876fabbcsi7797667pjb.111.2024.01.14.18.08.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 18:08:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25588-linux.lists.archive=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; spf=pass (google.com: domain of linux-kernel+bounces-25588-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25588-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 28580B20D77 for ; Mon, 15 Jan 2024 02:08:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9FCA17D2; Mon, 15 Jan 2024 02:08:37 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A24215BB for ; Mon, 15 Jan 2024 02:08:30 +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-cd-65a493978fc8 Date: Mon, 15 Jan 2024 11:08:18 +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: <20240115020817.GA56966@system.software.com> References: <20240111060757.13563-1-byungchul@sk.com> <20240111060757.13563-5-byungchul@sk.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: User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRmVeSWpSXmKPExsXC9ZZnoe70yUtSDbZNkLGYs34Nm8XnDf/Y LF5saGe0+Lr+F7PF0099LBaXd81hs7i35j+rxflda1ktdizdx2Rx6cACJovrux4yWhzvPcBk sXnTVGaL3z+A6uZMsbI4OWsyi4OAx/fWPhaPBZtKPTav0PJYvOclk8emVZ1sHps+TWL3eHfu HLvHiRm/WTx2PrT0mHcy0OP9vqtsHlt/2Xl83iTn8W7+W7YAvigum5TUnMyy1CJ9uwSujKvd p9kL5nBWvO+by9LAuIK9i5GTQ0LARGLj5XvMMPaRxpmMIDaLgKrElI2zWEBsNgF1iRs3fgLV cHCICGhIvNli1MXIxcEs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OzqjMy6zQS87P3cQIjKlltX8m7mD8ctn9EKMA B6MSD++Pv4tThVgTy4orcw8xSnAwK4nwHny+IFWINyWxsiq1KD++qDQntfgQozQHi5I4r1d4 aoKQQHpiSWp2ampBahFMlomDU6qBMXpxcaXPzysvg70EpXd4/lZf8jUzIH/p4csve4LeSirz vtMQSNRz7lrOsbKiY/LDQ8Ff2cxNmN2D5mg95/wuoHH/RH5M0dzwmSXnQ5e7LEhaOq3LItFx 7q20Fw3Nl97mSHH9z3slz15+Ly05OuXCm2jxlITjnB/4Ft2Wt88+mt9hfF8o65a6EktxRqKh FnNRcSIA8ieXD6UCAAA= X-CFilter-Loop: Reflected 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); > > 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 Cool. Thanks. Byungchul > perhaps