From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752103AbbEFWxT (ORCPT ); Wed, 6 May 2015 18:53:19 -0400 Received: from mail-la0-f44.google.com ([209.85.215.44]:34854 "EHLO mail-la0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751766AbbEFWxR (ORCPT ); Wed, 6 May 2015 18:53:17 -0400 From: Rasmus Villemoes To: Ingo Molnar , "Rafael J. Wysocki" , "Paul E. McKenney" Cc: Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: [PATCH 0/5] kernel/cpu.c: eliminate some indirection Date: Thu, 7 May 2015 00:52:49 +0200 Message-Id: <1430952775-4266-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The four cpumasks cpu_{possible,online,present,active}_bits are exposed readonly via the corresponding const variables cpu_xyz_mask. But they are also accessible for arbitrary writing via the exposed functions set_cpu_xyz. There's quite a bit of code throughout the kernel which iterates over or otherwise accesses these bitmaps, and having the access go via the cpu_xyz_mask variables is simply a useless indirection. The first four patches eliminate the cpu_xyz_mask variables by simply exposing the actual bitmaps, after renaming them to discourage direct access - that still happens through cpu_xyz_mask, which are now simply macros with the same type and value as they used to have. After that, there's no longer any reason to have the setter functions be out-of-line: The boolean parameter is almost always a literal true or false, so by making them static inlines they will usually compile to one or two instructions. Altogether, bloat-o-meter reports a saving of ~2600 bytes. Rasmus Villemoes (5): kernel/cpu.c: change type of cpu_possible_bits and friends kernel/cpu.c: export __cpu_xyz_mask drivers/base/cpu.c: use __cpu_xyz_mask directly kernel/cpu.c: eliminate cpu_xyz_mask kernel/cpu.c: make set_cpu_xyz static inlines drivers/base/cpu.c | 10 ++++---- include/linux/cpumask.h | 55 +++++++++++++++++++++++++++++++++++------- kernel/cpu.c | 64 ++++++++++--------------------------------------- 3 files changed, 65 insertions(+), 64 deletions(-) -- 2.1.3