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 71B37C433EF for ; Mon, 9 May 2022 04:21:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F09D16B0071; Mon, 9 May 2022 00:21:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB9EA6B0073; Mon, 9 May 2022 00:21:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D80CD6B0074; Mon, 9 May 2022 00:21:45 -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 C5D9C6B0071 for ; Mon, 9 May 2022 00:21:45 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 9B37380C48 for ; Mon, 9 May 2022 04:21:45 +0000 (UTC) X-FDA: 79444906170.09.5EF5331 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by imf06.hostedemail.com (Postfix) with ESMTP id 7C3EF180062 for ; Mon, 9 May 2022 04:21:42 +0000 (UTC) Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-2f863469afbso131509307b3.0 for ; Sun, 08 May 2022 21:21:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6o0Uik995yzG1w7JVfse+kra98IPXYjJG5F2pF4TKic=; b=ibOLlh6RmQZhKqv5XJlMc42zd3sWvBubvis7myJG8no9Bt38MZNP0xbMqAG1gF2ezX psJSukaKCqEVHp+UYj5aXqiSfOY5XMiX/fLWC02wqgRI5Uy6olX273yoYu9pAPfeQbzw AxmG4bh5uzuEhLqb+EzlH/Hd0XNWy0CO1afEhbVbLDgsQzJYSN7vKxjkoCjj9b/25AgH iUwPCzN7kaWrP/xrB90CtwgjBKwoyV+GWskNsX1TveNBrwfvGUEq0/Gf4wAcCkkBmgi0 38Rtl7xMSgpDcDNkgtcqoxJRnKMFbowcI+2TsF+8zs7BIGyTOGD0OU3hfvEyOAJVLs7O l42g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6o0Uik995yzG1w7JVfse+kra98IPXYjJG5F2pF4TKic=; b=w/7g5KzmyaOvarPw2OJECuOVMqrIEAsxuijuQumDkgrOsOHLL13YUZdCt/RapGqsTc VvG6BgA+ISvR+oiN6BmaPVcwsvJJUvK8d4CxHaTgeyru4LLzhTrtJbDhcpLB604fnVUR 6OXFNkjUeOEBsEmZcm3iFUnt0xIPQIUkowRHQ7WoiN9lRsDHS97lClSWq5482VJk5AqI 9hR35Fx0tMiEDX7wqrMjJsc/tNmNMa7v3gY0DrHVFPdvuPLPU5Tj552KP9RmD2hsG11i KBAsb0L5OIfEDriYIwBZ0HIhjKfwCiBwQKR9Ch+Q8N4mpy23i+1SxFBSdS66tCBfqDCF LpRw== X-Gm-Message-State: AOAM533oIz3LDfelyerbVgmyWKnHWzTsmRd17PaC+QME6fILcjuOrFp+ To2cK2NKVeWCX8jAwdglrHfi+kosaxuA8504n7YCqg== X-Google-Smtp-Source: ABdhPJySu0XRvPOatCo+tSO/VW8eZMm17WuYTUg2UQ1vOofroZ5K5T8cW9N/OFNOyWr+XrYq2AJaaEu7OFtCGaZODvI= X-Received: by 2002:a81:7b05:0:b0:2f4:e45a:b06e with SMTP id w5-20020a817b05000000b002f4e45ab06emr12223967ywc.458.1652070103623; Sun, 08 May 2022 21:21:43 -0700 (PDT) MIME-Version: 1.0 References: <20220425132723.34824-1-linmiaohe@huawei.com> <20220425132723.34824-4-linmiaohe@huawei.com> <09ccdbac-c267-15de-0d81-57e211dea6d2@huawei.com> In-Reply-To: <09ccdbac-c267-15de-0d81-57e211dea6d2@huawei.com> From: Muchun Song Date: Mon, 9 May 2022 12:21:06 +0800 Message-ID: Subject: Re: [PATCH v2 3/4] mm/migration: return errno when isolate_huge_page failed To: Miaohe Lin Cc: Andrew Morton , Mike Kravetz , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Huang Ying , Christoph Hellwig , dhowells@redhat.com, Christoph Lameter , David Hildenbrand , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 7C3EF180062 X-Stat-Signature: hq6rafqumdme1zj4m8i7ixwusehxmmcd Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ibOLlh6R; spf=pass (imf06.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-HE-Tag: 1652070102-936198 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 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. Thanks.