From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934731AbcCOMPw (ORCPT ); Tue, 15 Mar 2016 08:15:52 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33252 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934660AbcCOMPu (ORCPT ); Tue, 15 Mar 2016 08:15:50 -0400 Date: Tue, 15 Mar 2016 13:15:25 +0100 From: Ingo Molnar To: Linus Torvalds Cc: Linux Kernel Mailing List , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Thomas Gleixner , Peter Zijlstra , Andrew Morton Subject: Re: [PATCH] nohz: Change tick_dep_mask from 'unsigned long' to 'unsigned int' Message-ID: <20160315121525.GA3991@gmail.com> References: <20160314123200.GA15971@gmail.com> <20160315095337.GC7943@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160315095337.GC7943@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ingo Molnar wrote: > > Linus noticed that the new tick_dep_mask types introduced in: > > d027d45d8a17 ("nohz: New tick dependency mask") > > ... are sloppily defined as 'unsigned long' - which is wasteful > to carry just 4 bits and which may also create suboptimal data > types on 64-bit systems with word alignment padding holes in them. > > Fix this by changing the type to the more natural 'unsigned int'. > > (The xchg_or() API will work fine with 'unsigned int' as well.) > > Reported-by: Linus Torvalds > Cc: Chris Metcalf > Cc: Frederic Weisbecker > Cc: Christoph Lameter > Cc: Chris Metcalf > Cc: Ingo Molnar > Cc: Luiz Capitulino > Cc: Peter Zijlstra > Cc: Rik van Riel > Cc: Thomas Gleixner > Cc: Viresh Kumar > Signed-off-by: Ingo Molnar > --- > include/linux/sched.h | 4 ++-- > kernel/time/tick-sched.c | 11 +++++------ > 2 files changed, 7 insertions(+), 8 deletions(-) Hm, so the problem I did not consider is the following: triton:~/tip> git grep tick_dep_mask kernel | grep _bit kernel/time/tick-sched.c: clear_bit(bit, &tick_dep_mask); kernel/time/tick-sched.c: clear_bit(bit, &ts->tick_dep_mask); kernel/time/tick-sched.c: clear_bit(bit, &tsk->tick_dep_mask); kernel/time/tick-sched.c: clear_bit(bit, &sig->tick_dep_mask); and the bitops natural type (and in fact the only supported bitops type) is 'unsigned long'. So it's not that easy to change a bitmask over to unsigned int. Suggestions? Thanks, Ingo