Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2966088rwo; Thu, 3 Aug 2023 19:07:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnbbrRjeXusPpPVF4dl75RcAbl6tiji0Hqom8atZRKoj5vi/1vdDVqZ4Hz4I030yq8HPQE X-Received: by 2002:a5d:4603:0:b0:30a:ec3b:58d8 with SMTP id t3-20020a5d4603000000b0030aec3b58d8mr244340wrq.3.1691114846094; Thu, 03 Aug 2023 19:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691114846; cv=none; d=google.com; s=arc-20160816; b=rStWDJ9U1r+d0bZqK+99TJGqwQQ/qzJDM7XUG8b1EPJi0dc+pORXl4MTZcFNt7AP1+ YnIEPj59SIJu583ajsdCF1t7FdWZtFpJlpmedGvqjkcmETXha0Vi1oAGCRu+8/2UJ/88 bsw/Bxc7NWVl+TcX74la/CVhHORzIKzymKC8FyLquoonUQT7DIiwwlFwTsSboaQEJX5g PmQ7yZW1THrQHKYcDf9si6j5Bg2aFN1fInSTKTuaf4FEbVAqN825wvyDXMTo/oyKbGV7 FX4dD/Q60vw7fmjXduB63lpbwqTrs3y2uFryhs3WUjDI4xFJ7/Ev3N4LdRhKf+w1GTbo cKLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=y6wdz/g+TV5gKVqwcAaj6bO7IIeSolSJchFSEf2WzJM=; fh=08zchjjZCEdlVaczuHFGgg90DEcLIMaP9pASR7X0/Zc=; b=c/9fWNrjqQgYRAAjWBG4NW8T8pwn3AtuTrSRx2UKGUk4FUn/FY8e1fleWAJUFQr6DU aAc2DBuPrEUW9bXLYPshNEPEGFjHnPK1bMDGrG8CadeEu0OZYnJpufMBYdLOsVpbreeG zGC7nJMIOgSMG0eFXmzYpFcLnDDdt9m+4GIC/ORFpQnm4ny1Wyp7tsf3yDqR7I5a+VCC VyqDwtxFi3yS91dgtJLA8pxaap/sRbZbvjT4hn/fGqnIL2VZp2l9cNynHEiExuSFr/jo qkB7O2znolPxCE5b7xCSJsQq48Eb8G+VydYndMcoQRbyNlAUIiDeknNN8bWIWYNnUiZ4 jHiw== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l27-20020a056402345b00b005222a0cd29dsi793192edc.339.2023.08.03.19.07.01; Thu, 03 Aug 2023 19:07:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232455AbjHDBpi (ORCPT + 99 others); Thu, 3 Aug 2023 21:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbjHDBpg (ORCPT ); Thu, 3 Aug 2023 21:45:36 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5940E10D for ; Thu, 3 Aug 2023 18:45:35 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RH7m267YxzVjqW; Fri, 4 Aug 2023 09:43:46 +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.27; Fri, 4 Aug 2023 09:45:33 +0800 Message-ID: Date: Fri, 4 Aug 2023 09:45:32 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 From: Kefeng Wang Subject: Re: [PATCH 1/4] mm: migrate: use a folio in add_page_for_migration() To: Matthew Wilcox CC: Andrew Morton , , , Huang Ying , David Hildenbrand References: <20230802095346.87449-1-wangkefeng.wang@huawei.com> <20230802095346.87449-2-wangkefeng.wang@huawei.com> <001ee9b0-ea25-a896-e3ae-9a9b05a46546@huawei.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 2023/8/3 20:30, Matthew Wilcox wrote: > On Thu, Aug 03, 2023 at 03:13:21PM +0800, Kefeng Wang wrote: >> >> >> On 2023/8/2 20:21, Matthew Wilcox wrote: >>> On Wed, Aug 02, 2023 at 05:53:43PM +0800, Kefeng Wang wrote: >>>> err = -EACCES; >>>> - if (page_mapcount(page) > 1 && !migrate_all) >>>> - goto out_putpage; >>>> + if (folio_estimated_sharers(folio) > 1 && !migrate_all) >>>> + goto out_putfolio; >>> >>> I do not think this is the correct change. Maybe leave this line >>> alone. >> >> Ok, I am aware of the discussion about this in other mail, will not >> change it(also the next two patch about this function), or wait the >> new work of David. >>> >>>> - if (PageHuge(page)) { >>>> - if (PageHead(page)) { >>>> - isolated = isolate_hugetlb(page_folio(page), pagelist); >>>> + if (folio_test_hugetlb(folio)) { >>>> + if (folio_test_large(folio)) { >>> >>> This makes no sense when you read it. All hugetlb folios are large, >>> by definition. Think about what this code used to do, and what it >>> should be changed to. >> >> hugetlb folio is self large folio, will drop redundant check > > No, that's not the difference. Keep thinking about it. This is not > a mechanical translation! if (PageHuge(page)) // page must be a hugetlb page if (PageHead(page)) // page must be a head page, not tail isolate_hugetlb() // isolate the hugetlb page if head After using folio, if (folio_test_hugetlb(folio)) // only check folio is hugetlb or not I don't check the page is head or not, since the follow_page could return a sub-page, so the check PageHead need be retained, right?