Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp585238rwn; Thu, 8 Sep 2022 06:12:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR7U8kStDTU5MNGzgRDHwNHRHRfawbVqlMvFZJgGvTq6oUyv1GNjvPOhVdvX4Coq49raXAYv X-Received: by 2002:a05:6402:280f:b0:44e:ee5c:da6b with SMTP id h15-20020a056402280f00b0044eee5cda6bmr7229241ede.256.1662642730617; Thu, 08 Sep 2022 06:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662642730; cv=none; d=google.com; s=arc-20160816; b=RuseZ72c0yTuoosH1EUeDWUrNxMnqzUrLLmE7Hl7Pv0bjVx8q53GLiQ6SsftM+Dqfl bzv8EsXaSHmbpscoNzVBwcI8w507NHiFxl2xOafepgWz8AkPx0bHodweezvKDrITkkd5 v6EhZLoOcbQSfC036lvY/JZGehQxI1Ut7+dA/bMs3WzYUNirz8xR7/+xfBfCQrveSNT9 0AAv0p5adbQTopjQdk3UKMB7KBtV1l33APKTo8oB7FCrOV/9Ka+0myddXk762yoEw+Yx yeO243Vv90QmCWldNfcoTHg+6ynS4HUUENLJV+d0ZaZIN6xjRRRF8XfAGgbpsfF3sTQg 5rjA== 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 :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=DgTYBawCbdodaKAM95Dcksb6ObDT7bxJfitvy4sWMro=; b=s3dWAfr7jPcqnCxXyb/g7erEd4+66L4tLWdfVNJg2nRWoMJcZAYmdSfIWgM+GLMKJZ ukV3VFG3em8jaSeZUcZC+x0d1Ziabrc0uBBGC40ijEEIW4dm/zZQABB8gdRIo/Rs4MUU mYWxiDuR1p0bl4JVI38+kbfgcYJ7fOoeP0G5bJe+87JmGkJoV+g8EVPXCAQylSC2g/OX FSUEbLs9LWXednJ4aVkgT1vdhwwXqFUM274cyRcG4ZLtHlCUgtv+pnfVVG6OGjQXI+91 YRpayA1fYwPYmBOHCfk6PxxLcKBLm5xdEUKvrXiZ4elNmWq2Qy7w4U/17tVjxfzdeyee KZjw== 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 w3-20020a056402268300b004488842d88esi15928263edd.13.2022.09.08.06.11.42; Thu, 08 Sep 2022 06:12:10 -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 S232134AbiIHNHV (ORCPT + 99 others); Thu, 8 Sep 2022 09:07:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232122AbiIHNHP (ORCPT ); Thu, 8 Sep 2022 09:07:15 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D50AAE21C for ; Thu, 8 Sep 2022 06:07:10 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MNfSc5wJCzjXbL; Thu, 8 Sep 2022 21:03:28 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 8 Sep 2022 21:07:05 +0800 Received: from [10.174.179.24] (10.174.179.24) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 8 Sep 2022 21:07:04 +0800 Subject: Re: [PATCH v2] mm/huge_memory: prevent THP_ZERO_PAGE_ALLOC increased twice To: "Kirill A. Shutemov" References: <20220908035533.2186159-1-liushixin2@huawei.com> <20220908123102.rpihrmisv55j3b2o@box.shutemov.name> CC: Andrew Morton , "Kirill A . Shutemov" , Andrea Arcangeli , , , Kefeng Wang From: Liu Shixin Message-ID: <84a82033-ceb5-d8a2-3bae-a31574a5ff28@huawei.com> Date: Thu, 8 Sep 2022 21:07:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20220908123102.rpihrmisv55j3b2o@box.shutemov.name> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.24] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 2022/9/8 20:31, Kirill A. Shutemov wrote: > On Thu, Sep 08, 2022 at 11:55:33AM +0800, Liu Shixin wrote: >> If two or more threads call get_huge_zero_page concurrently, >> THP_ZERO_PAGE_ALLOC may increased two or more times. But actually, >> this should only count as once since the extra zero pages has been >> freed. Redefine its meaning to indicate the times a huge zero page >> used for thp is successfully allocated. > I don't particularly care, but it is not obvoius why the new behaviour is > better. The user who read the value may be more concerned about the huge zero pages that are really allocated using for thp and can indicated the times of calling huge_zero_page_shrinker. I misunderstood when I first saw it. > > All huge zero pages are freed apart from possibly the last one allocated. >