Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp299531ybj; Fri, 8 May 2020 12:07:50 -0700 (PDT) X-Google-Smtp-Source: APiQypLpURhIY9QlyMuTJnGcC6b3hBB19oWs3ADik59Ujk+JRpAVPi/cdj3ycgC0RNEFstRDxFAo X-Received: by 2002:a50:d615:: with SMTP id x21mr3234687edi.62.1588964869907; Fri, 08 May 2020 12:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588964869; cv=none; d=google.com; s=arc-20160816; b=r/kqN9ICjYNlhhCf8rqn46dWtpGOrDIATc1fwtKu/fUD5WD3gfW5OYKVNy/I1w3PM0 OGbjAaGsdMzSQm4aJfzIj+5drp8aG+1yevkD6hdUXt/8+TMrnGbofc5/K6SlKghJ18qH 40T4RzeqBAAEdXUi6zymhLUodo22Y7vJRjL/dSLRzTmxivD8+Dkgs0VSX2vMIzismumB NLWIqN0+56YtylDiqYmLDDlaVT3/fWi+UH1qL6hOD7x9QvmuR3ZYyqgTdxtOQJdb4ypf Ojge5Dg+aSb05MObNaEBEnvqk2W4GhbUFN70ACk//49pLocoAjm0+Nx7qEsJk4gTmiYQ hC7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:to:subject:dkim-signature; bh=XsDRaGkVfqyuEIS9XYvP0fqwdX3bL7AdrzNr+5CISAE=; b=kdIIkqO+W9/Ex7tZlyZ2NXil7EENtrcVAhsBToWxGMYBzstodvNEHyG29+DtSL9WdB rvZpcyluUgBlCWMbLNbxNxFaawz6RfDaJoNJTCDHczM32MjJ2VL53DGqoVTeBnaWMgxQ CygfNIrn7eZH6eihNHqbANDdAWgZ+7BksnhoTBHkaDzJKjUBUebfmB5LMXQpuNPPmde4 rqFE5bTuxaxbAjWqRQJSg7byvlRRQxSMAZlC0GPLpePAWhLyst0XNzrDgnUjo8t0y35O TIWUiOm6A1soYdY7Loy9avd6BHPWeIlVWJn7VsM9bO/Q5+MGNHXPgnlfSg1y68/VTcBM qsfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PfoPJenA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si1366497ejc.141.2020.05.08.12.07.26; Fri, 08 May 2020 12:07:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PfoPJenA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727106AbgEHTF1 (ORCPT + 99 others); Fri, 8 May 2020 15:05:27 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:39637 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726807AbgEHTF0 (ORCPT ); Fri, 8 May 2020 15:05:26 -0400 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-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> 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 >> a need to use up one dentry_stat entry for that? Besides one can get >> it by looking up the kernel dmesg log like: >> >> [    0.055212] Dentry cache hash table entries: 8388608 (order: 14, >> 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. I am not against using the last free entry for that. My only concern is when we want to expose another internal dcache data point via dentry-state, we will have to add one more number to the array which can cause all sort of compatibility problem. So do we want to use the last free slot for a constant that can be retrieved from somewhere else? Cheers, Longman