From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752169AbbIOXnS (ORCPT ); Tue, 15 Sep 2015 19:43:18 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:36363 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750764AbbIOXnQ (ORCPT ); Tue, 15 Sep 2015 19:43:16 -0400 MIME-Version: 1.0 In-Reply-To: <20150915052049.GA14215@gmail.com> References: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> <20150915014936.GA25658@htj.duckdns.org> <20150915052049.GA14215@gmail.com> Date: Tue, 15 Sep 2015 16:43:15 -0700 X-Google-Sender-Auth: 3LpOheO8XuCdUXzbhoWUqgI_BKo Message-ID: Subject: Re: [RFC][PATCH 0/5] Fixes for abs() usage on 64bit values From: Linus Torvalds To: Ingo Molnar Cc: John Stultz , Tejun Heo , LKML , Andrew Morton , "Steven Rostedt (Red Hat)" , Peter Zijlstra , Masami Hiramatsu , Michal Nazarewicz , Prarit Bhargava , Richard Cochran , Thomas Gleixner , "Theodore Ts'o" , Andreas Dilger , Dave Chinner , Peter Zijlstra Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14, 2015 at 10:20 PM, Ingo Molnar wrote: > > Linus, any preferences? I like the "auto-expand to 64-bit when necessary", but yes, that thing needs to continue to use a signed type. Using __builtin_choose_expr() would seem to be the right thing to do (not Andrew's version that makes the return type be s64 unconditionally). Just a quick grep shows that we currently use "abs()" on unsigned long and we expect it to be a signed comparison with zero, so the "simple" typeof that John suggested definitely will not work. Linus