Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4867249iob; Mon, 9 May 2022 03:35:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzS47imFykcBx++eEIwYNS7UfaOlv03U+051Trtdvb1zkpfQJFMjkmywB+0zY8xqY/VHTMr X-Received: by 2002:a02:cc48:0:b0:32b:14:4186 with SMTP id i8-20020a02cc48000000b0032b00144186mr6252344jaq.189.1652092526066; Mon, 09 May 2022 03:35:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652092526; cv=none; d=google.com; s=arc-20160816; b=VXqhMyA5lNjMBho8qcB4oALS4VmUXyTaRWp+lEP1H29aA2OF7I5MPxIODccPHX5sbA wxqZu2Ipk9PuLOny4vqCF/LRKU5Wn320FaR7T/FGqb48ucZA6HL43Qa2EumyCjJnOrDT TAzMP8YQ78ODqNKGve3EFXxbemHi+Kcrwn9XBwefqCnyeN0ySJqiotAgm4noBWzmnSy0 EtD8Y7F7a3CE4dQj1iSIdwlGaksZLNnbq6XFB9/hVBwANkFikQxkNvv5Fc+v0CQ0+mXg aFkBSZPgNIHNpJEAH2Od6QKS7nymcysrJPuhWFbtegld787Vcq7pn1f/usMjy1EsStA6 PHrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=v9UXneATQOmk+ix1gJ4rw2iJlFTslQ1ThtMFqktHaaY=; b=ON1YvvTMTQnXRT9u70xi/RZhze0+uSYlyVyt+eDW0NcGUH/av+as7/qakvnUeaNdjO kj6Vs5keJbBDIJm1iAnxaFSMYT5x0l6oDnjzfZ93LGOQaITcfN513wZzcDXfQ/aGnjbJ 1r3IXIJPoxJXba0WtM/GrlBKCxcsGFh3xyrWrPmpCHD7rvgg41liNDUKLgMqxel6gBGS kB5Nf6odNUfWxBzeJQiGP+8g2/EVpPVPmPcw2kaWNtdyojubGu59wCBjTtj76bIMvuie /zL6RiXzLm9y7crIQKGUwI4FPM5PdLLoWwSo6Ku3X4QNFb0RP1YDAZ8LSL2B7zoVmdvn 87xA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n13-20020a056638210d00b0032b8ca53853si10916518jaj.158.2022.05.09.03.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 03:35:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1460D2655F2; Mon, 9 May 2022 03:05:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236169AbiEII0s (ORCPT + 99 others); Mon, 9 May 2022 04:26:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236303AbiEIIRL (ORCPT ); Mon, 9 May 2022 04:17:11 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E83C1595BE for ; Mon, 9 May 2022 01:12:55 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4KxYCf71WDzCsP6; Mon, 9 May 2022 15:46:54 +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 15:51:39 +0800 Subject: Re: [PATCH v2 3/4] mm/migration: return errno when isolate_huge_page failed To: Muchun Song CC: Andrew Morton , Mike Kravetz , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Huang Ying , Christoph Hellwig , , Christoph Lameter , David Hildenbrand , Linux Memory Management List , LKML References: <20220425132723.34824-1-linmiaohe@huawei.com> <20220425132723.34824-4-linmiaohe@huawei.com> <09ccdbac-c267-15de-0d81-57e211dea6d2@huawei.com> From: Miaohe Lin Message-ID: Date: Mon, 9 May 2022 15:51:39 +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: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 2022/5/9 12:21, Muchun Song wrote: > On Mon, May 9, 2022 at 11:24 AM Miaohe Lin wrote: >> >> 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? >> > > There is also a function named folio_isolate_lru(). My initial consideration was > making it consistent with folio_isolate_lru(). isolate_hugetlb looks good to me > as well. I see. Many thanks for your explanation. :) > > Thanks. > . >