Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp486507imw; Wed, 13 Jul 2022 02:15:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tw5f3C1+owwzkVRMnxJysneEGseTOGNNdeN45oKYM7QoVuDNPrTtgbY4OvzpET1lna4KhD X-Received: by 2002:a17:90a:c4f:b0:1df:a178:897f with SMTP id u15-20020a17090a0c4f00b001dfa178897fmr2756415pje.19.1657703706975; Wed, 13 Jul 2022 02:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657703706; cv=none; d=google.com; s=arc-20160816; b=O68SumWLHdWI20wJlIBsc+wsaqym69RgedgrtEiquQ/yTW5xWinCuFOYHXLGUSjX3h U94dxDSVBdnxhyy9VVhe4izV0+VJHtVNhjC9xAgfFhxbKKGusHDvJuEu+h6b0+GVXdfz nYtgV6ZR+Q8bZF0NhLUZmCzeRvh67SN2gj07sXKSyB4RBNtbcZga3MMRY6Uj5OOlqxdS 9X5moHir1R9ggkWsWoqsFkzYRbOi9qP+rOBu/Tet0p7Fm9+qWjX4j45Q2xEDVaGefm8K puLB/h2f5bxqrCKIQ53OHTrj8RKuyta6wR4yeThdKejLdPqQKRkN4Ab2yP5yR3nkSfTf h1Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=BkgAv29tSFpvotwnucNQca/PByR7wAH4syTqOuuQviM=; b=SIccMscoyJSf2QuC2KovJQDaZ1jyBMWSYc4Rts5efvI1MqhmcUvRjN1Mu2K6C1RnPG X61IdHmzzsv9WR8YjMbVkOfR7TigDj/5IycUDjI30i3H7i6dV+JIVtKskKEK7UY3M3vK XolKI94+ZsC87r63pxiF250MlGjPQ1aXMSG/qJ6fAU7blow6mQgrI/LxEyyFMRn3OsBE NMSJScG2EXCbGsM8NDA6V9lCi3kUItyZ0zEXKgHzbR4NfThKg5bLa7cm1JJeEtpuhXit 2pCSMu3Qigfc29TK6cWboCvs80BUaX2t+d8JI1fHW7WsfCziPs0z6TYhMVVZKVP3Srfr RpZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GUTfm0VA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c38-20020a631c26000000b0041255c88c3esi16888290pgc.525.2022.07.13.02.14.54; Wed, 13 Jul 2022 02:15:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GUTfm0VA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229863AbiGMIaj (ORCPT + 99 others); Wed, 13 Jul 2022 04:30:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235238AbiGMIaf (ORCPT ); Wed, 13 Jul 2022 04:30:35 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F74071BE0 for ; Wed, 13 Jul 2022 01:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657701035; x=1689237035; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=YQUSBazFo/c4fVEPXFT3RG1PGjmSxbf7eA6p2HwqTTo=; b=GUTfm0VASzTQ05aMMkq2k7jDE5CaolM1Z6Qr1L9mucIGJ4Fm5kMqmebZ jQubqqeiQf0M/SsISnMjx+A83nommhqxsu5/gK5JQJTufAvhonhg355BY 9A7/3lrvit4Pyj0C64tEoK0hTcUezajeiP6fHHox+XOXQzAW/+Ds0EhjS E6wwyOddTJjYdELAbZ6oI1yL6eVgpdyhW4EkQ4QSGsOlE52Pvy0pHGcrK owtfBvljnEB4C17vyHQzOkkNGQenCPTwx5BtW9DVhLe3RG/ZfnypbHfaY 2RzLGC8jrA/KN2mhbcDTFq31HHZf4VNdM2Et5uitOKzPT/06EoYJJcRM+ Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10406"; a="283905557" X-IronPort-AV: E=Sophos;i="5.92,267,1650956400"; d="scan'208";a="283905557" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2022 01:30:34 -0700 X-IronPort-AV: E=Sophos;i="5.92,267,1650956400"; d="scan'208";a="570535384" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.239.13.94]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2022 01:30:32 -0700 From: "Huang, Ying" To: Oscar Salvador Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baolin Wang , Zi Yan , Yang Shi Subject: Re: [PATCH -V2 5/7] migrate_pages(): fix failure counting for THP on -ENOSYS References: <20220711084948.274787-1-ying.huang@intel.com> <20220711084948.274787-6-ying.huang@intel.com> Date: Wed, 13 Jul 2022 16:30:27 +0800 In-Reply-To: (Oscar Salvador's message of "Mon, 11 Jul 2022 14:26:20 +0200") Message-ID: <87wnch4dp8.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oscar Salvador writes: > On Mon, Jul 11, 2022 at 04:49:46PM +0800, Huang Ying wrote: >> If THP or hugetlbfs page migration isn't supported, unmap_and_move() >> or unmap_and_move_huge_page() will return -ENOSYS. For THP, splitting >> will be tried, but if splitting doesn't succeed, the THP will be left >> in "from" list wrongly. If some other pages are retried, the THP >> migration failure will counted again. This is fixed via moving the >> failure THP from "from" to "ret_pages". >> >> Another issue of the original code is that the unsupported failure >> processing isn't consistent between THP and hugetlbfs page. Make them >> consistent in this patch to make the code easier to be understood too. >> >> Signed-off-by: "Huang, Ying" >> Fixes: 5984fabb6e82 ("mm: move_pages: report the number of non-attempted pages") >> Reviewed-by: Baolin Wang >> Cc: Zi Yan >> Cc: Yang Shi >> --- >> mm/migrate.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/mm/migrate.c b/mm/migrate.c >> index 4bceba143db0..8cce73b7c046 100644 >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >> @@ -1192,10 +1192,8 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, >> * tables or check whether the hugepage is pmd-based or not before >> * kicking migration. >> */ >> - if (!hugepage_migration_supported(page_hstate(hpage))) { >> - list_move_tail(&hpage->lru, ret); >> + if (!hugepage_migration_supported(page_hstate(hpage))) >> return -ENOSYS; >> - } >> >> if (page_count(hpage) == 1) { >> /* page was freed from under us. So we are done. */ >> @@ -1392,6 +1390,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, >> * page will be put back >> * -EAGAIN: stay on the from list >> * -ENOMEM: stay on the from list >> + * -ENOSYS: stay on the from list >> * Other errno: put on ret_pages list then splice to >> * from list >> */ >> @@ -1421,6 +1420,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, >> } >> >> nr_failed_pages += nr_subpages; >> + list_move_tail(&page->lru, &ret_pages); > > I must be missing something, but migrate_pages() calls unmap_and_move_huge_page() > with ret being ret_pages, so > > list_move_tail(&hpage->lru, ret) == list_move_tail(&page->lru, &ret_pages) > > Yet, you say "This is fixed via moving the failure THP from "from" to "ret_pages"". > /me confused. To make it consistent between hugetlb page and THP/normal page, I have revised the unmap_and_move_huge_page() via deleting the list_move_tail() there for ENOSYS. After that, we move the hugetlb page and THP/normal page in the same way in migrate_pages(). Best Regards, Huang, Ying