From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 34345C43334 for ; Mon, 27 Jun 2022 04:24:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D49F6B0071; Mon, 27 Jun 2022 00:24:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 783DD6B0072; Mon, 27 Jun 2022 00:24:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 673168E0001; Mon, 27 Jun 2022 00:24:52 -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 59A5B6B0071 for ; Mon, 27 Jun 2022 00:24:52 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 301FF3247D for ; Mon, 27 Jun 2022 04:24:52 +0000 (UTC) X-FDA: 79622725224.21.893E0A6 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by imf13.hostedemail.com (Postfix) with ESMTP id E771F20025 for ; Mon, 27 Jun 2022 04:24:49 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R801e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VHRTyK._1656303885; Received: from 30.32.122.103(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VHRTyK._1656303885) by smtp.aliyun-inc.com; Mon, 27 Jun 2022 12:24:46 +0800 Message-ID: <4e1d1501-f979-77fa-532e-a107bcb8a950@linux.alibaba.com> Date: Mon, 27 Jun 2022 12:24:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 6/7] migrate_pages(): fix failure counting for THP splitting To: Huang Ying , akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, shy828301@gmail.com, ziy@nvidia.com References: <20220624025309.1033400-1-ying.huang@intel.com> <20220627022450.1067783-1-ying.huang@intel.com> From: Baolin Wang In-Reply-To: <20220627022450.1067783-1-ying.huang@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656303891; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f3XiNnRC8KL4G6zEi9T1H8fYWHPsvDs2dGt7vfmnrso=; b=MvLmVxj8g9U810XOy9bHQT11YUYHGU7q6v/7I86tKHakW3suISvwFGG/yWjQY07Udx5NPS tlYrlJwgIwufIEy3CdHsgfnuXYqQGDfeUUNOn26D98q0MqxNw1eN3fbKn3IDZ0lgBTZ0DY 0K3BGAMfQGnqj2YTNCg43lk/f9Xk2xw= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf13.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.45 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656303891; a=rsa-sha256; cv=none; b=Mu/03C/2JNN5/LqO23i5nw3Rd/AZrWA8S5uPM72qLlHEwuCiel0erK/N3etn5KFC40vc43 kFmKTyyoYur0p5oP1o0VCtCnISWYssx5nB0L7qN1/Em6Bna4s5eZKnUoxLMtaRyORp/anL yWbeTiKvL6xwD53TWd2cXzoc4Zz9pvA= X-Rspamd-Queue-Id: E771F20025 Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf13.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.45 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: qcbfijckiwjdzkozi1goqu6eym96hphp X-HE-Tag: 1656303889-884949 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: On 6/27/2022 10:24 AM, Huang Ying wrote: > If THP is failed to be migrated, it may be split and retry. But after > splitting, the head page will be left in "from" list, although THP > migration failure has been counted already. If the head page is > failed to be migrated too, the failure will be counted twice > incorrectly. So this is fixed in this patch via moving the head page > of THP after splitting to "thp_split_pages" too. > > Signed-off-by: "Huang, Ying" > Fixes: 5984fabb6e82 ("mm: move_pages: report the number of non-attempted pages") > Cc: Baolin Wang > Cc: Zi Yan > Cc: Yang Shi > --- Good catch. LGTM. Reviewed-by: Baolin Wang > mm/migrate.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 9d1883d5927f..70a0e1f34c03 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1305,6 +1305,8 @@ static inline int try_split_thp(struct page *page, struct list_head *split_pages > lock_page(page); > rc = split_huge_page_to_list(page, split_pages); > unlock_page(page); > + if (!rc) > + list_move_tail(&page->lru, split_pages); > > return rc; > } > @@ -1364,7 +1366,6 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > thp_retry = 0; > > list_for_each_entry_safe(page, page2, from, lru) { > -retry: > /* > * THP statistics is based on the source huge page. > * Capture required information that might get lost > @@ -1411,7 +1412,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > nr_thp_failed++; > if (!try_split_thp(page, &thp_split_pages)) { > nr_thp_split++; > - goto retry; > + break; > } > /* Hugetlb migration is unsupported */ > } else if (!no_subpage_counting) { > @@ -1431,7 +1432,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > /* THP NUMA faulting doesn't split THP to retry. */ > if (!nosplit && !try_split_thp(page, &thp_split_pages)) { > nr_thp_split++; > - goto retry; > + break; > } > } else if (!no_subpage_counting) { > nr_failed++;