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 X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF060C38A2A for ; Fri, 8 May 2020 19:05:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8F5F92173E for ; Fri, 8 May 2020 19:05:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PfoPJenA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F5F92173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2EFDA900003; Fri, 8 May 2020 15:05:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C61B8E0005; Fri, 8 May 2020 15:05:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20297900003; Fri, 8 May 2020 15:05:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id 08FFE8E0005 for ; Fri, 8 May 2020 15:05:27 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A4DAC8248068 for ; Fri, 8 May 2020 19:05:26 +0000 (UTC) X-FDA: 76794480252.16.class71_69af96cfffc19 X-HE-Tag: class71_69af96cfffc19 X-Filterd-Recvd-Size: 3801 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 May 2020 19:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588964725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XsDRaGkVfqyuEIS9XYvP0fqwdX3bL7AdrzNr+5CISAE=; b=PfoPJenATFPVjkPwST56PQMZEVvIBkkq0KTTjgSThEcvWoaOv8ZedrSknMHtKRq6+fEW9b 7yQPE7XJP8HLEGexMpPZbiO9eyJi0Pozw24rb2oNMrbHnmOtREgVDtfOxnnUbncJqr0giZ NJR+hEvtxYCtz6QPYxwCIbkQjEUH2L4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-444-VyoKLMhUOt2U1vweSATWPQ-1; Fri, 08 May 2020 15:05:21 -0400 X-MC-Unique: VyoKLMhUOt2U1vweSATWPQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1B13053; Fri, 8 May 2020 19:05:20 +0000 (UTC) Received: from llong.remote.csb (ovpn-117-83.rdu2.redhat.com [10.10.117.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 228FF1053B1B; Fri, 8 May 2020 19:05:19 +0000 (UTC) Subject: Re: [PATCH RFC 1/8] dcache: show count of hash buckets in sysctl fs.dentry-state To: Konstantin Khlebnikov , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Alexander Viro References: <158893941613.200862.4094521350329937435.stgit@buzz> <158894059427.200862.341530589978120554.stgit@buzz> <7c1cef87-2940-eb17-51d4-cbc40218b770@redhat.com> From: Waiman Long Organization: Red Hat Message-ID: <741172f7-a0d2-1428-fb25-789e38978d4e@redhat.com> Date: Fri, 8 May 2020 15:05:18 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Content-Transfer-Encoding: quoted-printable 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 5/8/20 12:16 PM, Konstantin Khlebnikov wrote: > On 08/05/2020 17.49, Waiman Long wrote: >> On 5/8/20 8:23 AM, Konstantin Khlebnikov wrote: >>> Count of buckets is required for estimating average length of hash=20 >>> chains. >>> Size of hash table depends on memory size and printed once at boot. >>> >>> Let's expose nr_buckets as sixth number in sysctl fs.dentry-state >> >> The hash bucket count is a constant determined at boot time. Is there=20 >> a need to use up one dentry_stat entry for that? Besides one can get=20 >> it by looking up the kernel dmesg log like: >> >> [=C2=A0=C2=A0=C2=A0 0.055212] Dentry cache hash table entries: 8388608= (order: 14,=20 >> 67108864 bytes) > > Grepping logs since boot time is a worst API ever. > > dentry-state shows count of dentries in various states. > It's very convenient to show count of buckets next to it, > because this number defines overall scale.=20 I am not against using the last free entry for that. My only concern is=20 when we want to expose another internal dcache data point via=20 dentry-state, we will have to add one more number to the array which can=20 cause all sort of compatibility problem. So do we want to use the last=20 free slot for a constant that can be retrieved from somewhere else? Cheers, Longman