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 CE1A6C001B0 for ; Wed, 16 Aug 2023 00:50:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED7478D001B; Tue, 15 Aug 2023 20:50:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E87748D0001; Tue, 15 Aug 2023 20:50:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4F1B8D001B; Tue, 15 Aug 2023 20:50:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C62608D0001 for ; Tue, 15 Aug 2023 20:50:21 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8DF34C010B for ; Wed, 16 Aug 2023 00:50:21 +0000 (UTC) X-FDA: 81128136642.07.D2B57C3 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf08.hostedemail.com (Postfix) with ESMTP id 337F7160018 for ; Wed, 16 Aug 2023 00:50:17 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692147019; 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=5UaM1pMRUca2V0EyJPPgotvBS4UgEB5re0F9a0auhos=; b=ut3FBGFgwPkrlkd4kM5hgV4cJHt6JuwdFUTi4pzosZP8paIrbUNyY9T6AjK7jzVztJbJ6H e+QdtwGC0ttUOkRptSOs+Xc5D0oabDL3kkXrI/pDm8IbwrKMfIhGTWZREIBWCLW10I33UI gz/+57tr/Prg/DFWe9laKcNstC2zv5U= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692147019; a=rsa-sha256; cv=none; b=5ocESCR0TGhCjAU0TQQwzibh1B96UhhSY8xba+g1zlKU25lXoj330bsUyCh/UfWCESbErJ v08jfns9RtjXMAYbkYEhv3LidHsZGGvJyYGPKOfIbsF6rdnQITp4kQ41YDNxS9ygdcrBoZ 52G0Lic0QrPDxUvJxLaARb3FdWN/tLU= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RQTz91PzDzrS81; Wed, 16 Aug 2023 08:48:53 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 16 Aug 2023 08:50:13 +0800 Message-ID: <2a834c28-2122-482a-9db6-8b8572932b10@huawei.com> Date: Wed, 16 Aug 2023 08:50:12 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] mm: migrate: use a folio in add_page_for_migration() Content-Language: en-US To: Mike Kravetz , "Huang, Ying" CC: Zi Yan , Naoya Horiguchi , Matthew Wilcox , Andrew Morton , , , David Hildenbrand References: <5BBFF5D3-3416-4C0E-9FDD-655661657D67@nvidia.com> <20230809205316.GA3537@monkey> <20230809224424.GB3537@monkey> <2da95492-079b-43b1-a950-d290984a21c0@huawei.com> <20230810162920.GA4734@monkey> <87wmxx7y9j.fsf@yhuang6-desk2.ccr.corp.intel.com> <20230815211226.GA4150@monkey> From: Kefeng Wang In-Reply-To: <20230815211226.GA4150@monkey> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 337F7160018 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: tdm65nrmjanahyhcf4m8buzkk8o8d3gb X-HE-Tag: 1692147017-288621 X-HE-Meta: U2FsdGVkX18hn5aVcQjesavJ6Akze4Viz89j+5rzesZh/NxjxFbbB1xBQZC2+CyC/AUj6K+6eNvLO1zMS4qkVF1HDWry+mcazlHoMPyQO0x0PmVqFuv42GVSlBoknIcpUKoBRTMcZIw0y2ISpx+qfgze/+iPd6VB7NJyEVcT3qPWBxsEADcXKSlbWXv0tCrPETMDb/q1yv1Ij+mRnAniAZDvuintBNX/GOg8qBHJIfoRvD4CmniP7E6+BlLDNhevDcB3fsFpCb1m+HO6dDheKV0t+YsGvS1uZ9Ufae2t1pFe59q4FfRu04jFqfxmZ0tv2Y508WxUuql8n4w6Zt1qUAkNfjQw2JqO5Oi+kkEwWSaTJvzKALxLfk3J//YY78ffc5fqy3WYbmBpbJ9c5jRnWQqnYgTrvQ8w1gKRMwY0GjciMunbYqVnvlGE9LGlz48frfWBroEWYCwhl8myFBTR+Px1LS601vh4H3bCKV7LkRivimpihy8A1pYffDxhYYqW/NNgrDFcIs5h7J9s6OQM050mMCjnPBP1YbKXb6Y+Ot7HrENP9kJEohexo94z/QEvooJ3A6WlenWuRtM2mb1l1irZIfHEKkJOiZWDKdXa3ZeDc1xhw3SW/U7CjERtSRidtAGMZS9PW9mLjB/VbBwbD9zBE2YxTqgnNA2URZkEhzN13gYJ4+05h1ITBpKXyWTj4/E9RiKCcr2o/+LYwZhKvNcdIqLHSHlrBlbJ7Mx2FXaFQT4i8Wl69vcXma5maGbyOaIfc4IWfHA+b8C02/Vwouy/BMn2lllxtDBIl8dvDDxVFlvUbSS9MJl0TKBrF09r9cHZcroZEjdHbEkDwO8AF+qnOUXXBj1yvUtwqWE2DKndSwJUS4ar3KX14s90Rhjk3A+TgR3u8QxSm9cM5bsGMoDE6Z1FMF0kdMGgKkelknyg8rCCTBkqKEs6fH0uz6omkOXZzPT5qYIOOMvNjj6 69XPMjpG lGt3pzsk2374iojnvPnCIBBkGoHQbvsKVn69CieT/QGbLPtJSYUlnm/5Yq/STGfWzna6VoiSZrROWfg/uv0rxOL5LMMOOsb/F0rQUvdfu43rTLMkftcPCbgM7+SS6yddwWLuMjB8GiUxt+LM9sHXuB+tLg5c5sJMLfZBfDEDBSyiZUi8EbSBAu9/HxbJbC9Qw55ACxJYUGjWutjsPmRoMg2YC+RvFtzqH9gRARtwaiz0eRdlofLNj/YLBKA== 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 2023/8/16 5:12, Mike Kravetz wrote: > On 08/15/23 11:58, Huang, Ying wrote: >> Mike Kravetz writes: >> >>> On 08/10/23 09:49, Kefeng Wang wrote: >>>> >>>> >>>> On 2023/8/10 6:44, Mike Kravetz wrote: >>>>> On 08/09/23 13:53, Mike Kravetz wrote: >>>>>> On 08/09/23 20:37, Kefeng Wang wrote: >>>>>>>> >>>>>>>> Cc Mike to help us clarify the expected behavior of hugetlb. >>>>>>>> >>>>>>>> Hi Mike, what is the expected behavior, if a user tries to use move_pages() >>>>>>>> to migrate a non head page of a hugetlb page? >>>>>>> >>>>>>> Could you give some advise, thanks >>>>>>> >>>>>> >>>>>> Sorry, I was away for a while. >>>>>> >>>>>> It seems unfortunate that move_pages says the passed user addresses >>>>>> should be aligned to page boundaries. However, IIUC this is not checked >>>>>> or enforced. Otherwise, passing a hugetlb page should return the same >>>>>> error. >>>>>> >>>>>> One thought would be that hugetlb mappings should behave the same >>>>>> non-hugetlb mappings. If passed the address of a hugetlb tail page, align >>>>>> the address to a hugetlb boundary and migrate the page. This changes the >>>>>> existing behavior. However, it would be hard to imagine anyone depending >>>>>> on this. >>>>>> >>>>>> After taking a closer look at the add_page_for_migration(), it seems to >>>>>> just ignore passed tail pages and do nothing for such passed addresses. >>>>>> Correct? Or, am I missing something? Perhaps that is behavior we want/ >>>>>> need to preserve? >>>>> >>>>> My mistake, status -EACCES is returned when passing a tail page of a >>>>> hugetlb page. >>>>> >>>> >>>> As mentioned in previous mail, before e66f17ff7177 ("mm/hugetlb: take >>>> page table lock in follow_huge_pmd()") in v4.0, follow_page() will >>>> return NULL on tail page for Huagetlb page, so move_pages() will return >>>> -ENOENT errno, but after that commit, -EACCES is returned. >>>> >>>> Meanwhile, the behavior of THP/HUGETLB is different, the whole THP will be >>>> migrated on a tail page, but HUGETLB will return -EACCES(after v4.0) >>>> or -ENOENT(before v4.0) on tail page. >>>> >>>>> Back to the question of 'What is the expected behavior if a tail page is >>>>> passed?'. I do not think we have defined an expected behavior. If >>>>> anything is 'expected' I would say it is -EACCES as returned today. >>>>> >>>> >>>> My question is, >>>> >>>> Should we keep seem behavior between HUGETLB and THP, or only change the >>>> errno from -EACCES to -ENOENT/-EBUSY. >>> >>> Just to be clear. When you say "keep seem behavior between HUGETLB and THP", >>> are you saying that you would like hugetlb to perform migration of the entire >>> hugetlb page if a tail page is passed? >>> >>> IMO, this would be ideal as it would mean that hugetlb and THP behave the same >>> when passed the address of a tail page. The fewer places where hugetlb >>> behavior diverges, the better. However, this does change behavior. >> >> A separate patch will be needed for behavior change. >> > > Correct. > > Since the goal of this series is to convert to folios, we should maintain the > existing behavior and errno (-EACCES). In a subsequent patch, we can > change behavior. > > That would be my suggestion. Thanks all, will following the suggestion and re-post.