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 86317C38145 for ; Thu, 8 Sep 2022 13:07:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7CC26B0072; Thu, 8 Sep 2022 09:07:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D2C978D0001; Thu, 8 Sep 2022 09:07:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1AFF6B0074; Thu, 8 Sep 2022 09:07:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B401D6B0072 for ; Thu, 8 Sep 2022 09:07:12 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7CF1FA9516 for ; Thu, 8 Sep 2022 13:07:12 +0000 (UTC) X-FDA: 79888943904.05.94ECCBE Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf16.hostedemail.com (Postfix) with ESMTP id 814EE18007F for ; Thu, 8 Sep 2022 13:07:11 +0000 (UTC) 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 ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662642432; a=rsa-sha256; cv=none; b=qlIuYZj2nqj0ynLs2YTAgCIJK/u1yxJlqfCcYiHYrW86XRY9IQkRe4IBgumJbsNqFp9zxg Ue1aI0HcCQPVU8SQ3rI1DBQrVyzdZUO9vVtBe6LWSGNMZ+x1sUAmadAp6y38BQ0yc0DxEw gWVsX/BuA6nimJWAJrrgwnFY1nZYKfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662642432; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DgTYBawCbdodaKAM95Dcksb6ObDT7bxJfitvy4sWMro=; b=Z5qvaa8JslDFJiOUmKVIVxJ89ae04js4JMTNufGQLA1bMfc+gwvZsrsHwblm+TqAoklNPN R1XZ+1foerdB75qGqk3be0GaxMfev15xUA7kgKR5cLn0kvscMZ8cM9av/itMoEmgcHpvUm xTBv1024HSNJyPmYEAVkUBpYbCEoxQo= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 814EE18007F Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: kas4mu9hwny7dybbzrwzigashir9b5tp X-Rspam-User: X-HE-Tag: 1662642431-91370 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/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. >