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=-8.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 7631EC43387 for ; Wed, 9 Jan 2019 21:03:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E474206B7 for ; Wed, 9 Jan 2019 21:03:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=mailprotect.be header.i=@mailprotect.be header.b="BMa/X5ss" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727819AbfAIVDH (ORCPT ); Wed, 9 Jan 2019 16:03:07 -0500 Received: from com-out001.mailprotect.be ([83.217.72.83]:43691 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727712AbfAIVDC (ORCPT ); Wed, 9 Jan 2019 16:03:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=Q7xA0GDmMHhgRMqMFsp8hECvSOtsZQmF1tF+hJRQ2fk=; b=BMa/X5ssa7yg obU5+6XsZQKrlTPSchEb/YzmH0ATenKP7fiz6eUvWV63koSEFgI60e21lJaiEng6QgkehbwBSyrlS YBeJk87pqcs5uzf2JgyotXcuDvDG5HBDT0fA7xp38bOf3/ck6Ow0boGtrqjrO2TT5uhjKbHeOaqzt ChHXKs0S9MMVcDLBcpAurNVtUnR5qOdK5faNjMtMDryeITNe65gEFfkFn2PgF/198KPYDwAP/cTVM xRVWKLaWvm4fPgGWNivxKlWEO6zPCYFjZsPWlu8b2nyoBZHF2YdKvWTPhfIrcziyXN2GhoH13ML74 xkbMo0h/k95ueghJEXHmVQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.159]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1ghKzm-0009Cq-56; Wed, 09 Jan 2019 22:02:39 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id AC4BFC07CD; Wed, 9 Jan 2019 22:02:17 +0100 (CET) From: Bart Van Assche To: peterz@infradead.org Cc: mingo@redhat.com, tj@kernel.org, longman@redhat.com, johannes.berg@intel.com, linux-kernel@vger.kernel.org, Bart Van Assche , Johannes Berg Subject: [PATCH v6 01/16] locking/lockdep: Fix reported required memory size Date: Wed, 9 Jan 2019 13:01:49 -0800 Message-Id: <20190109210204.192109-2-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.97.g81188d93c3-goog In-Reply-To: <20190109210204.192109-1-bvanassche@acm.org> References: <20190109210204.192109-1-bvanassche@acm.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Originating-IP: 178.208.39.159 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.04) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5sKHZyMAipyrB7uNJOZQLZ1602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u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q4VabSfIGUY8RJ38dSGEP+JYPRX76oPSBtBBPLYw1mZQfhvSXPX1npIQpGBE7 MnJiHvQ8gQs8eCOaG4DvtrnB4hxWBV/7jCqhcJq0hur2OKHH5lr9xXvSM4nM3avg X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change the sizeof(array element time) * (array size) expressions into sizeof(array). This fixes the size computations of the classhash_table[] and chainhash_table[] arrays. Commit a63f38cc4ccf ("locking/lockdep: Convert hash tables to hlists") namely changed the type of the elements of that array from struct list_head into struct hlist_head. Lock chains are only tracked with CONFIG_PROVE_LOCKING=y. Do not report the memory required for the lock chain array if CONFIG_PROVE_LOCKING=n. See also commit ca58abcb4a6d ("lockdep: sanitise CONFIG_PROVE_LOCKING"). Include the size of the chain_hlocks[] array. Cc: Peter Zijlstra Cc: Waiman Long Cc: Johannes Berg Signed-off-by: Bart Van Assche --- kernel/locking/lockdep.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 95932333a48b..cb3fa7042886 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -4278,20 +4278,21 @@ void __init lockdep_init(void) printk("... MAX_LOCKDEP_CHAINS: %lu\n", MAX_LOCKDEP_CHAINS); printk("... CHAINHASH_SIZE: %lu\n", CHAINHASH_SIZE); - printk(" memory used by lock dependency info: %lu kB\n", - (sizeof(struct lock_class) * MAX_LOCKDEP_KEYS + - sizeof(struct list_head) * CLASSHASH_SIZE + - sizeof(struct lock_list) * MAX_LOCKDEP_ENTRIES + - sizeof(struct lock_chain) * MAX_LOCKDEP_CHAINS + - sizeof(struct list_head) * CHAINHASH_SIZE + printk(" memory used by lock dependency info: %zu kB\n", + (sizeof(list_entries) + + sizeof(lock_classes) + + sizeof(classhash_table) + + sizeof(chainhash_table) #ifdef CONFIG_PROVE_LOCKING - + sizeof(struct circular_queue) + + sizeof(lock_cq) + + sizeof(lock_chains) + + sizeof(chain_hlocks) #endif ) / 1024 ); - printk(" per task-struct memory footprint: %lu bytes\n", - sizeof(struct held_lock) * MAX_LOCK_DEPTH); + printk(" per task-struct memory footprint: %zu bytes\n", + sizeof(((struct task_struct *)NULL)->held_locks)); } static void -- 2.20.1.97.g81188d93c3-goog