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 EC705C61DB3 for ; Mon, 9 Jan 2023 07:24:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DDDA8E0002; Mon, 9 Jan 2023 02:24:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 58DFA8E0001; Mon, 9 Jan 2023 02:24:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 456158E0002; Mon, 9 Jan 2023 02:24:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 33BED8E0001 for ; Mon, 9 Jan 2023 02:24:22 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 123FB140465 for ; Mon, 9 Jan 2023 07:24:21 +0000 (UTC) X-FDA: 80334422364.01.8C588DD Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf24.hostedemail.com (Postfix) with ESMTP id 1714018000C for ; Mon, 9 Jan 2023 07:24:18 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=mABNgH6r; spf=pass (imf24.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673249059; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MZRz+d7HIA7dRS5jxwks2fSMYKByALVKr7ZjzVqQFYY=; b=LZ9BnDRa5Dssu/B9mpyn9krg2NHU3InR6bem8mWHsQSnHys/341jJyO4O5l5i1zmAaK4HM nrFMUjeZmhy1VV2FZvOiHgVvm12w+MYPHqnN0utHmJG8iNP+fc6M28XqtjHiy74KaE/AVK XQGg+RAjp8Rgk4OTj9dloMZKKXmoxUU= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=mABNgH6r; spf=pass (imf24.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.88 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673249059; a=rsa-sha256; cv=none; b=KLRcqFoxKEco3RWHwienQGFzDrGxPW757sZMyAgiz2PAEWtbERNTjyLdeCGCOOxQJDdipC ZFaHBxrudqksubDFCfIlKiPwSvumcaR5O7nP0DQS9tS7gvAz8DBV15GHjSh0ktNa0usEfd Bod8fF0/AGTUevjWmZQ6e42gqQjgvL0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673249059; x=1704785059; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=7IuvSph9kr4u0JaBkExjjY/5PCAEw1jXvnA0UpXIL2Y=; b=mABNgH6r3GQR58psCXMqhvRJhVX1UUyCFHpfo58YFcr2hFDBsPvti4uL kxKU5xSg89kdMzdPsIGJfueYRNdNiiLpHJ/QijXiN2nk0tMjrHxUsa4q/ yDKw1Txo0UaQvD2TOEDwOzLPIcuLnAMmmqSsnAnc2UAYaEVWFxamKjLfa TcYFtYVxnu+ibUzyaj/uWZpbaPCuW/I80pHiO2zNgPD2/NPkXnLUPxFHL 6muD00ugJh9ZyuoYsV+DaVYkEBxbYAMud1v/KEdsRKcMmRWE7s77d38zD 5LwcM4MVT9CkJ1lW5yI1VCVAQNs8/K0OmBlFuJn/c/Nj6863OWLZ6MOku w==; X-IronPort-AV: E=McAfee;i="6500,9779,10584"; a="350023793" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="350023793" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2023 23:24:16 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10584"; a="725072753" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="725072753" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2023 23:24:13 -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> <87k021bfpj.fsf@yhuang6-desk2.ccr.corp.intel.com> <87y1qhqv5k.fsf@nvidia.com> Date: Mon, 09 Jan 2023 15:23:03 +0800 In-Reply-To: <87y1qhqv5k.fsf@nvidia.com> (Alistair Popple's message of "Thu, 05 Jan 2023 18:39:59 +1100") Message-ID: <87fsck5fzc.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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 1714018000C X-Rspam-User: X-Stat-Signature: 3pipfoo9rpqe3oridz89rnt7w4xsnitc X-HE-Tag: 1673249058-631201 X-HE-Meta: U2FsdGVkX1/sVN/Q8BE2PI+UwJhOGWhVFJin/XBgGQh/wEENEGoCdwqqtnL7IgtfCd6gc6FgyJ5pW1rC9pLAVNQ0vdDF8VmFjLdm4qenHosF9+2vLDSXADJQD9uG3pr5AiqB54Q30G8GCCKWwI4886uDJ6Qdt0Hz511nFeQve2wbtAh+4K5Lslmo41w608OY2XelE1hQV7dp1Ica/ix0y3uXE/mqpQmXjF4YQ5yD6DLXmM5GGD8a7dybGx6h2L7rjWvFU7jnvS/CdD5jejm/JZw6P4BqPrCV7LQX8x5X89guOvkRWfuzxxuWNbd35OkAcJApvcrE/+aM0rZhGqiq4d2nGiLZz1mZBvZzWGSko/nq0UbTg8YQFQWsvqKkCUfYxNt4APNAGwzK1A8NT+CoTNI4Z3/ybUFALzWZa1yezDAVvpGUtpvt3r+2ViszP/pM8GMT2mQoxMMKCU9QULC9+FKRwaMedKA0Soch1vhXP9FAQw2MzOEfgg4azoct8hHUSQeLYj7PqLCyn2pO3g8w+3ZcRQefEFlrkAlo/UyoDMtcUzoCzbJEK4xWEKuu27/79GctTzXSYauFuEQQUz0N67taxTVuX25g7gzIGY/0KsZix+UXtiqHUHSNGQvkQQ/em5lGBt9PGwfo+piU/KmRgB5j1itVQsx9uAahkd75y21awMAmP7dEWKs+F4sZx+cbN2i5GJKie6lPiKB6YoP7Rs4pC1UyjX15zi7QHYHrWp+MZjutAOv7hDK9QRPHOHSqzm/F32TwLewWbjzUP3A2E26Yn8NiPMcrEb5ifzC4zJf/LE+jam6u3eDXp+qDgiy/X34YvvVMMEgJw3L90Hb3xJPMV97c4BnscL5FtCYj9Ps7kUBKQMWIsQtlF/awKvv55g668fWnSU9JYFt1oihGBiTFr9wcjfdF 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: Alistair Popple writes: > "Huang, Ying" writes: > >> [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. > > Why? Couldn't we test pass == 9 and remove it from the list if it fails > the final retry in migrate_hugetlbs()? In any case if it's on the list > due to failed retries we have already passed over it 10 times, so the > extra loop hardly seems like a problem. Yes. That's possible. But "test pass == 9" looks more tricky than the current code. Feel free to change the code as you suggested on top this series. If no others object, I'm OK with that. OK? 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++; >>>>>> }