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 A2CBFC433F5 for ; Mon, 9 May 2022 03:24:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0CB346B0071; Sun, 8 May 2022 23:24:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05BF16B0073; Sun, 8 May 2022 23:24:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5D9E6B0074; Sun, 8 May 2022 23:24:03 -0400 (EDT) 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 D71D06B0071 for ; Sun, 8 May 2022 23:24:03 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B724B2F65A for ; Mon, 9 May 2022 03:24:03 +0000 (UTC) X-FDA: 79444760766.22.322E592 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf14.hostedemail.com (Postfix) with ESMTP id 1D9F510008B for ; Mon, 9 May 2022 03:24:00 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KxRMc6rLNzhZ0R; Mon, 9 May 2022 11:23:24 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 9 May 2022 11:24:00 +0800 Subject: Re: [PATCH v2 3/4] mm/migration: return errno when isolate_huge_page failed To: Muchun Song CC: , , , , , , , , , References: <20220425132723.34824-1-linmiaohe@huawei.com> <20220425132723.34824-4-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: <09ccdbac-c267-15de-0d81-57e211dea6d2@huawei.com> Date: Mon, 9 May 2022 11:23:59 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1D9F510008B X-Rspam-User: X-Stat-Signature: 8ud3xynwnc6c68fnk9u9obh9zkkkoqwa X-HE-Tag: 1652066640-505307 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 2022/4/29 19:36, Muchun Song wrote: > On Mon, Apr 25, 2022 at 09:27:22PM +0800, Miaohe Lin wrote: >> We might fail to isolate huge page due to e.g. the page is under migration >> which cleared HPageMigratable. So we should return -EBUSY in this case >> rather than always return 1 which could confuse the user. Also we make >> the prototype of isolate_huge_page consistent with isolate_lru_page to >> improve the readability. >> >> Fixes: e8db67eb0ded ("mm: migrate: move_pages() supports thp migration") >> Suggested-by: Huang Ying >> Signed-off-by: Miaohe Lin >> --- >> include/linux/hugetlb.h | 6 +++--- >> mm/gup.c | 2 +- >> mm/hugetlb.c | 11 +++++------ >> mm/memory-failure.c | 2 +- >> mm/mempolicy.c | 2 +- >> mm/migrate.c | 5 +++-- >> 6 files changed, 14 insertions(+), 14 deletions(-) >> >> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h >> index 04f0186b089b..306d6ef3fa22 100644 >> --- a/include/linux/hugetlb.h >> +++ b/include/linux/hugetlb.h >> @@ -170,7 +170,7 @@ bool hugetlb_reserve_pages(struct inode *inode, long from, long to, >> vm_flags_t vm_flags); >> long hugetlb_unreserve_pages(struct inode *inode, long start, long end, >> long freed); >> -bool isolate_huge_page(struct page *page, struct list_head *list); >> +int isolate_huge_page(struct page *page, struct list_head *list); >> int get_hwpoison_huge_page(struct page *page, bool *hugetlb); >> int get_huge_page_for_hwpoison(unsigned long pfn, int flags); >> void putback_active_hugepage(struct page *page); >> @@ -376,9 +376,9 @@ static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, >> return NULL; >> } >> >> -static inline bool isolate_huge_page(struct page *page, struct list_head *list) >> +static inline int isolate_huge_page(struct page *page, struct list_head *list) > > Since you already touched all the call sites, how about renaming this > to hugetlb_isolate()? I've always felt that huge_page is not a > straightforward and clear name since we also have another type of > huge page (THP). I think hugetlb is more specific. > Sorry for late respond. This suggestion looks good to me. But is isolate_hugetlb more suitable? This could make it more consistent with isolate_lru_page? What do you think? Thanks! > Thanks. > > . >