Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3523390rwb; Mon, 5 Sep 2022 13:20:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR72ujGKNYc1Yy49j8vqG7zh+h4UksSfGkfHqyHlG9VuQf2CInElQsfqJ+03UpNZa+sZNDtm X-Received: by 2002:a63:6b87:0:b0:41c:2fb4:24f1 with SMTP id g129-20020a636b87000000b0041c2fb424f1mr43963181pgc.452.1662409247959; Mon, 05 Sep 2022 13:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662409247; cv=none; d=google.com; s=arc-20160816; b=O6Tsme0zcSRiKKESRK5UTHQbNanwT1lLzJFJIS2e8LJjnVFbTrhple8GL8NKF9TVP2 pyRUgQicbD0J5nxJGH6mEYTCV4Gn1XHTJd1PcV0D5L6lEgGyK3a/j3bbSUGkqpj8Pzhn IPiJm/jPnil2M2D68mS6eUwlhUiK5EK9xdMMmSwk6FIhW6ER2Y7y9Cd+qpl/9K2zuooI 4pcR2R4I5NQpQztf6uHm5kFa5MXNdZDwWy31Ni+4yUGB4MousVGtcP8raKJqiSdklXbP nrC63C7ip8+tQi9dnt8ya5/STMNLXmOChenRXr8x5V3RRvkCN2h9bCN/BQC3qLwFKDg0 rF9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=bokwg7xdyQCTcQIFNpViOCCoKirBggqhDDEmWOHnoS4=; b=gnT3yfK18qCs0B8mWjrWdZZMAkOMIHoDCuSgP2LM8hUYMG5qoEL37gXTUrPZZV6s4W AlcWdkady4MwKAHKNdveLOTelDE7nPV9Rb5nmvQPj1+T7hZduvGmaENhrkBtony0FrLx hTPJgm8r4e09Tx8I9XbDtAfeYkmoYTyORgZx+httR0FWjikx4HTyMKr241zydyLiOM3c PNVxpfTKi3ck8J1Xz7iJYmPzTqeoaRgmsMJrB1XMPMcQ/twQEGKAqjtBn3HCiPjMqvKO N4fz1CQh3RxedXhutKLbfK3uoad2ENIBqhDb9tvbd5GyQ31S1UAsOchshlBo3D3PoXAI g/9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=oecxaYBa; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170902690300b0016bea2a8b16si10431722plk.364.2022.09.05.13.20.29; Mon, 05 Sep 2022 13:20:47 -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; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=oecxaYBa; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231209AbiIEUHc (ORCPT + 99 others); Mon, 5 Sep 2022 16:07:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbiIEUHb (ORCPT ); Mon, 5 Sep 2022 16:07:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42C521EEEF for ; Mon, 5 Sep 2022 13:07:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D21A2601BD for ; Mon, 5 Sep 2022 20:07:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D5BEC433D6; Mon, 5 Sep 2022 20:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1662408449; bh=ysM9awpw0A2M34q5JF3n3+0RW+KGU1zgTfvVfudH32Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oecxaYBa382HbPtWr3k1hVeYfFE3D4Ang+wYKMylmV+PLsjYj5BzbU7EvmMU4rVg6 PvuoEB5byW/91Ca1yoXE1cSyPQHCKUKSSeMoT5aF+Z1JIAvR5W3C53Vy422ZjIDm8g eB1YPrhQWOFcCtyKaGWaHt9BWFb6X2n6qA660nwQ= Date: Mon, 5 Sep 2022 13:07:28 -0700 From: Andrew Morton To: Liu Shixin Cc: , , Kefeng Wang Subject: Re: [PATCH] mm/huge_memory: prevent THP_ZERO_PAGE_ALLOC increased twice Message-Id: <20220905130728.1e814d185b189faece6f2c2f@linux-foundation.org> In-Reply-To: <20220905133813.2253703-1-liushixin2@huawei.com> References: <20220905133813.2253703-1-liushixin2@huawei.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, 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 Mon, 5 Sep 2022 21:38:13 +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. Well, for better of for worse, Documentation/admin-guide/mm/transhuge.rst says thp_zero_page_alloc is incremented every time a huge zero page is successfully allocated. It includes allocations which where dropped due race with other allocation. Note, it doesn't count every map of the huge zero page, only its allocation. If you think this interprtation should be changed then please explain why, and let's be sure to update the documentation accordingly.