Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp497120rwl; Wed, 4 Jan 2023 23:49:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXvqCnr9nWk0f/U3WA2lN4YpFAW9wkPsPadN7UGe+UR7QNN96RzQHNvJIxD72HG9ytVk4T1T X-Received: by 2002:a17:90b:1989:b0:219:f1a2:b665 with SMTP id mv9-20020a17090b198900b00219f1a2b665mr56353783pjb.5.1672904984176; Wed, 04 Jan 2023 23:49:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672904984; cv=none; d=google.com; s=arc-20160816; b=WE/B7Jk/JyjuwycJwPbqkXl2+3iB6Kwm+s35YX8QtNuVi6cyS6l1m3yHCoIOvusu7V If7kpz/wPbbQdWBrwPmDcRm1gXP8Rq7A+IUWEnGdMif7JNBSGXYGtaOhb7BfwnIW7/6o Mfvnv8fetliZ11OD5c6UQ1LmnEwzs9yTAUpvpIKFuBPmw/9UFhuqvTT7YIQooXd4barH gceGgBwdXySFIr4IjW3vpa9om/1RwnJPN+upvX/VfrRwwqPZkDYjQVKJi0glbbwfKkqx 9l1zgzKCCSLhljNGvCdCXj/kpseF8wuVHHZwm9XKOLippuGIbkLlHvW8VZWgCH55mXA2 aX+w== 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=9MaBBo8xvEAxIfMh+DxUA4oeL+AKU3qvK+JnCLliEGo=; b=ZdkpIuA5hKTsQIcmFYjxHxqX7ckKCB62XXAztdW9/vK2+1FYjyWodqnlprRZxLr+mE zO16oDIMow8vDXbThps/L4X/Fu+GJI4AjNCc7lPqSc0Q7xn6Rsz3EKHmSFhVVKUnoDGK up9sl7QRyIskpyhV0kHQQLkCZF3RdPhxHrpxQpmd41ikJEX4FSf/QhRmu2E74UMi5/VY 5yR5T+lnFRDdb31iWgod2AWAshyRYcgmJInMBQ0VbA10G53jW67wA/Ss7KPP7v4vPMQo 7PYiz/ESj7vt8DyLYQgIqgCPZPl9rgX5meDGdWgSMsbCSZv/WGKO8+W7MATY+Qc4a3mJ 0oAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BYjYqKvP; 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 j8-20020a17090a94c800b00219d1f4b86fsi1232439pjw.117.2023.01.04.23.49.36; Wed, 04 Jan 2023 23:49:44 -0800 (PST) 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=BYjYqKvP; 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 S231316AbjAEHcR (ORCPT + 55 others); Thu, 5 Jan 2023 02:32:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231201AbjAEHcH (ORCPT ); Thu, 5 Jan 2023 02:32:07 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59504544FA for ; Wed, 4 Jan 2023 23:32:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672903921; x=1704439921; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=ypUCWeLyZTiSpVtwCmCkkmx5F06n0mwIxits+2J+LcA=; b=BYjYqKvPWz4Jo1JGSVmHBpCdsYSriGHFgL4PsRF62rFPqANhgGkhYSrM rM188CFZpXh5r3zR2jVVyV18QD69TDyhm2N2sfxwJTulD4GHcHjtdHmLy FdlnxuOy4wKF5Z3eV//OrclJUG/ZkOCvWTwda08MIRpOcirOhF6D6/CjE foeiaqyIuarWxQn9+kT4MqVj9q1WMYsfpwGr/qv59JyRHyBv8JRTEP1eS +yadaPJuBXiRdInpGVmwwBBmHHhdXuCtd4hu7uvR02tz6x32ytuo4+fQl Z3BgOdW8NKQFjuFm85nBzzSqf2othzcRW7V+B1iGme/cs98HtAmLoBBVw Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="384432193" X-IronPort-AV: E=Sophos;i="5.96,302,1665471600"; d="scan'208";a="384432193" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2023 23:32:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="984191588" X-IronPort-AV: E=Sophos;i="5.96,302,1665471600"; d="scan'208";a="984191588" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2023 23:31:57 -0800 From: "Huang, Ying" To: Alistair Popple Cc: Andrew Morton , , , Zi Yan , Yang Shi , Baolin Wang , "Oscar Salvador" , Matthew Wilcox , "Bharata B Rao" , haoxin Subject: Re: [PATCH 2/8] migrate_pages: separate hugetlb folios migration References: <20221227002859.27740-1-ying.huang@intel.com> <20221227002859.27740-3-ying.huang@intel.com> <87pmbttxmj.fsf@nvidia.com> <87pmbtedfp.fsf@yhuang6-desk2.ccr.corp.intel.com> <877cy1scg5.fsf@nvidia.com> Date: Thu, 05 Jan 2023 15:31:04 +0800 In-Reply-To: <877cy1scg5.fsf@nvidia.com> (Alistair Popple's message of "Thu, 05 Jan 2023 17:43:05 +1100") Message-ID: <87k021bfpj.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=-4.4 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 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 [snip] > >>>> @@ -1462,30 +1549,28 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, >>>> nr_retry_pages = 0; >>>> >>>> list_for_each_entry_safe(folio, folio2, from, lru) { >>>> + if (folio_test_hugetlb(folio)) { >>> >>> How do we hit this case? Shouldn't migrate_hugetlbs() have already moved >>> any hugetlb folios off the from list? >> >> Retried hugetlb folios will be kept in from list. > > Couldn't migrate_hugetlbs() remove the failing retried pages from the > list on the final pass? That seems cleaner to me. To do that, we need to go through the folio list again to remove all hugetlb pages. It could be time-consuming in some cases. So I think that it's better to keep this. Best Regards, Huang, Ying >>>> + list_move_tail(&folio->lru, &ret_folios); >>>> + continue; >>>> + } >>>> + >>>> /* >>>> * Large folio statistics is based on the source large >>>> * folio. Capture required information that might get >>>> * lost during migration. >>>> */ >>>> - is_large = folio_test_large(folio) && !folio_test_hugetlb(folio); >>>> + is_large = folio_test_large(folio); >>>> is_thp = is_large && folio_test_pmd_mappable(folio); >>>> nr_pages = folio_nr_pages(folio); >>>> + >>>> cond_resched(); >>>> >>>> - if (folio_test_hugetlb(folio)) >>>> - rc = unmap_and_move_huge_page(get_new_page, >>>> - put_new_page, private, >>>> - &folio->page, pass > 2, mode, >>>> - reason, >>>> - &ret_folios); >>>> - else >>>> - rc = unmap_and_move(get_new_page, put_new_page, >>>> - private, folio, pass > 2, mode, >>>> - reason, &ret_folios); >>>> + rc = unmap_and_move(get_new_page, put_new_page, >>>> + private, folio, pass > 2, mode, >>>> + reason, &ret_folios); >>>> /* >>>> * The rules are: >>>> - * Success: non hugetlb folio will be freed, hugetlb >>>> - * folio will be put back >>>> + * Success: folio will be freed >>>> * -EAGAIN: stay on the from list >>>> * -ENOMEM: stay on the from list >>>> * -ENOSYS: stay on the from list >>>> @@ -1512,7 +1597,6 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, >>>> stats.nr_thp_split += is_thp; >>>> break; >>>> } >>>> - /* Hugetlb migration is unsupported */ >>>> } else if (!no_split_folio_counting) { >>>> nr_failed++; >>>> }