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 X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA81FC43463 for ; Fri, 18 Sep 2020 03:24:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1E597235FD for ; Fri, 18 Sep 2020 03:24:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E597235FD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5F5C86B0070; Thu, 17 Sep 2020 23:24:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A6F26B0072; Thu, 17 Sep 2020 23:24:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BD276B0073; Thu, 17 Sep 2020 23:24:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id 2F4F96B0070 for ; Thu, 17 Sep 2020 23:24:38 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E94EC180AD811 for ; Fri, 18 Sep 2020 03:24:37 +0000 (UTC) X-FDA: 77274739794.17.trip70_540e45527127 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id C909F180D0181 for ; Fri, 18 Sep 2020 03:24:37 +0000 (UTC) X-HE-Tag: trip70_540e45527127 X-Filterd-Recvd-Size: 3697 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 03:24:37 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6822830E; Thu, 17 Sep 2020 20:24:36 -0700 (PDT) Received: from [10.163.74.228] (unknown [10.163.74.228]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 888843F73B; Thu, 17 Sep 2020 20:24:34 -0700 (PDT) Subject: Re: [PATCH v2] mm/migrate: correct thp migration stats. To: Zi Yan , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Daniel Jordan References: <20200917210413.1462975-1-zi.yan@sent.com> From: Anshuman Khandual Message-ID: <50eb6f68-40be-89ee-3431-e382cf94f7c5@arm.com> Date: Fri, 18 Sep 2020 08:53:54 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200917210413.1462975-1-zi.yan@sent.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Hi Zi, On 09/18/2020 02:34 AM, Zi Yan wrote: > From: Zi Yan > > PageTransHuge returns true for both thp and hugetlb, so thp stats was > counting both thp and hugetlb migrations. Exclude hugetlb migration by > setting is_thp variable right. Coincidentally, I had just detected this problem last evening and was in the process of sending a patch this morning :) Nonetheless, thanks for the patch. Earlier there was a similar THP-HugeTLB ambiguity down the error path as well. In hindsight, I should have noticed or remembered about this earlier fix during the THP stats patch. e6112fc30070 (mm/migrate.c: split only transparent huge pages when allocation fails) > > Clean up thp handling code too when we are there. > > Fixes: 1a5bae25e3cf ("mm/vmstat: add events for THP migration without split") > Signed-off-by: Zi Yan > Reviewed-by: Daniel Jordan > Cc: Daniel Jordan > Cc: Anshuman Khandual > --- > mm/migrate.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 941b89383cf3..6bc9559afc70 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1445,7 +1445,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > * Capture required information that might get lost > * during migration. > */ > - is_thp = PageTransHuge(page); > + is_thp = PageTransHuge(page) && !PageHuge(page); > nr_subpages = thp_nr_pages(page); > cond_resched(); > > @@ -1471,7 +1471,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > * we encounter them after the rest of the list > * is processed. > */ > - if (PageTransHuge(page) && !PageHuge(page)) { > + if (is_thp) { > lock_page(page); > rc = split_huge_page_to_list(page, from); > unlock_page(page); > @@ -1480,8 +1480,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > nr_thp_split++; > goto retry; > } > - } > - if (is_thp) { > + > nr_thp_failed++; > nr_failed += nr_subpages; > goto out; > Moving the failure path inside the split path makes sense, now that it is already established that the page is indeed a THP. Reviewed-by: Anshuman Khandual