Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751878AbbDEHce (ORCPT ); Sun, 5 Apr 2015 03:32:34 -0400 Received: from www.osadl.org ([62.245.132.105]:40943 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750825AbbDEHcc (ORCPT ); Sun, 5 Apr 2015 03:32:32 -0400 From: Nicholas Mc Guire To: Michal Marek Cc: Masahiro Yamada , Sam Ravnborg , Thomas Gleixner , "H. Peter Alvin" , Joe Perches , John Stultz , Andrew Hunter , Paul Turner , linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH 0/3] time: use __builtin_constant_p() in msecs_to_jiffies Date: Sun, 5 Apr 2015 09:23:53 +0200 Message-Id: <1428218636-3780-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1800 Lines: 42 In the overall kernel source there currently are 2544 msecs_to_jiffies 126 usecs_to_jiffies and a few places that are using var * HZ / 1000 constructs which are not always safe (no check of corner cases) and should be switched to msecs_to_jiffies (roughly 25 left). Allowing gcc to fold constants for these calls that in most cases are passing in constants (roughly 95%) has some potential to improve performance (and should save a few bytes). size impact: x86_64_defconfig: without patches vmlinux 24628843 with patches vmlinux 24628797 ppc64_defconfig: without patches 27412024 with patches 27412040 (no clue why it is bigger!) multi_v7_defconfig: without patches vmlinux.o 22901462 with patches vmlinux.o 22899843 As the changes to the top level Kbuild will impact every architecture this is probably not enough testing - but should be suitable for a first review. Once this is clean a patch for usecs_to_jiffies will be provided as well The patch set: 0001 moves timeconst.h from kernel/time/ to include/generated/ and makes it available early enough so that the build can use the constants for msecs_to_jiffies 0002 rename msecs_to_jiffies to __msecs_to_jiffies, the only modification is that the < 0 is moved out. modified version of msecs_to_jiffies that checks for constant via call to __builtin_constant_p() and calls __msecs_to_jiffies if it can't determine that the argument is constant. 0003 documentation update and reformatting to kernel-doc format -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/