Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754027AbcKSQMi (ORCPT ); Sat, 19 Nov 2016 11:12:38 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34437 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753397AbcKSQM0 (ORCPT ); Sat, 19 Nov 2016 11:12:26 -0500 From: Nicolai Stange To: Thomas Gleixner Cc: John Stultz , linux-kernel@vger.kernel.org, Nicolai Stange Subject: [RFC v8 26/28] clockevents: degrade ->retries to unsigned int Date: Sat, 19 Nov 2016 17:10:34 +0100 Message-Id: <20161119161036.12679-15-nicstange@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161119160055.12491-1-nicstange@gmail.com> References: <20161119160055.12491-1-nicstange@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2033 Lines: 52 Being of type unsigned long, the struct clock_event_device's ->retries member is incremented in clockevents_program_min_delta() and used for diagnostic purposes in /proc/timer_list only. Turning ->retries' type into unsigned int avoids the introduction of some padding with future reorderings of struct clock_event_device for the case of sizeof(unsigned long) == sizeof(void*) == 8. This is turn prevents these reorganizations from making sizeof(struct clock_event_device) cross a multiple of the cacheline size, assumed to be equal to 64 bytes. For the case of HZ=1000, this change still allows for 2^32 / HZ / (3600*24) = 49 days without overwrap, even in the highly unrealistic case of one clockevents_program_min_delta() invocation per tick. Thus, change ->retries' type from unsigned long to unsigned int. Adapt the format specifier or /proc/timer_list accordingly. Signed-off-by: Nicolai Stange --- include/linux/clockchips.h | 2 +- kernel/time/timer_list.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index e07f421..878a802 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -115,7 +115,7 @@ struct clock_event_device { u32 shift; enum clock_event_state state_use_accessors:8; unsigned int features:24; - unsigned long retries; + unsigned int retries; int (*set_state_periodic)(struct clock_event_device *); int (*set_state_oneshot)(struct clock_event_device *); diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index 9067760..6a8d54f 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c @@ -271,7 +271,7 @@ print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu) SEQ_printf(m, " event_handler: "); print_name_offset(m, dev->event_handler); SEQ_printf(m, "\n"); - SEQ_printf(m, " retries: %lu\n", dev->retries); + SEQ_printf(m, " retries: %u\n", dev->retries); SEQ_printf(m, "\n"); } -- 2.10.2