Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7328015imm; Thu, 28 Jun 2018 01:43:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKeaI5yb3GIje4r4ho8OAe3SZsii+bY1rgpKURPH2HKxzTuocUSu23NgbZnujCKHvUCyKm7 X-Received: by 2002:a17:902:b410:: with SMTP id x16-v6mr9502650plr.324.1530175391833; Thu, 28 Jun 2018 01:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530175391; cv=none; d=google.com; s=arc-20160816; b=Q1LqJp1/sk0cvTu2tR9kTgm921tldf832sy+EnMEIcsJLKXJq166wl87cSjyD2wqLL u5u1ii9IdkaLuopOnc/+AGUA1cRDeXSCQRdGNqawzaneJ/sJiBIBNlHJ7QvLrGU+ic+d xwdDKFCJeke4NFS9thPdQK+fmjoHfWJx2HAEs0+LoyMKkZesndgNj5hautpK8R9Enrl7 k9LE2W37SepeM6D9ZIGpVy9lDSnUjEuuTppj7mRFkbMLHJ8cRGFwWzHMml80a7HlG81C XmBMOxVKbswmeaJ6DPwuIyRWoU4VyMCr+KoAdOlQdHAOkXrvmqtajkzalBBAwlsdJO/4 nQ5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=h4xKpgE2MQLtBZJkuVS8FjXWkeZEK3fhTY/y4XX9agM=; b=yz3ut+xB09sUyKze3cAGeJjI+q9piNkRSQrQp9veU/kb5Dycw40S2V1Dqn5fvOg75o afHDYQsWXDNqSLHMd1EeT8F3a3ijMkqLnqmc+HVPdzO7TjW/KG3J75970R2qfKa3bhhB Pmxr0S7mUb7dwhhBfU2qMWpWG9oobQyhxkY5dlnu/Q840NiW/tRncUQiRsgvgrlxDs7Y WFkd0d3XYYijYt6OTZ7ERv/J/XQQlFbt/rWRT1aymz+C1JoMSqkza7DY+bmDsh98OelB jKqYre4BFOYbD9D4Z+7gMJcD2U+JqjyscvZQNA1OXdbzmqyWvt52aJyOesVH3bypC1SI EzFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=w8JWlmrh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si5917278plp.443.2018.06.28.01.42.54; Thu, 28 Jun 2018 01:43:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=w8JWlmrh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752311AbeF1IkQ (ORCPT + 99 others); Thu, 28 Jun 2018 04:40:16 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52352 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbeF1IkO (ORCPT ); Thu, 28 Jun 2018 04:40:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=h4xKpgE2MQLtBZJkuVS8FjXWkeZEK3fhTY/y4XX9agM=; b=w8JWlmrhbMTvoP/D9Pz41JBIa 83UrwBjtk1SdYcNgdfwKpSw668XjzTbhtn2ApxYgj/WbUIhnOrmi05/Xt9zg/njoxMrElyj4B2zQz 0AB/GoqDNUlbJHtAKpi2W8K3uV4om3X3Dfy8/q8rxyQJf8QPRTTUKjr+4evT6DrROeUwiMmMse5Qv 7H/FbzstJjue7I+vkMnPYZaah+hYL6t3mfll0UNEgGMBA7Kjt8E1CdzQAz20Z0jW0P+n+xKiWy7b5 PMhSOz9Nz17YmAAtrQmelkfLIbA3fy3ecB0dCLFL4o86zuK4EL8boqbHqETTkS4NAZKUmyptS6Brs eJk8d0dPA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fYSTD-0002eS-TL; Thu, 28 Jun 2018 08:40:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A9CBF20297645; Thu, 28 Jun 2018 10:40:02 +0200 (CEST) Date: Thu, 28 Jun 2018 10:40:02 +0200 From: Peter Zijlstra To: Ard Biesheuvel , g@hirez.programming.kicks-ass.net Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Arnd Bergmann , Steven Rostedt Subject: Re: [PATCH 1/5] kernel/jump_label: abstract jump_entry member accessors Message-ID: <20180628084002.GZ2494@hirez.programming.kicks-ass.net> References: <20180627160604.8154-1-ard.biesheuvel@linaro.org> <20180627160604.8154-2-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180627160604.8154-2-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 27, 2018 at 06:06:00PM +0200, Ard Biesheuvel wrote: > diff --git a/kernel/jump_label.c b/kernel/jump_label.c > index 01ebdf1f9f40..c3524c9b3004 100644 > --- a/kernel/jump_label.c > +++ b/kernel/jump_label.c > @@ -38,10 +38,12 @@ static int jump_label_cmp(const void *a, const void *b) > const struct jump_entry *jea = a; > const struct jump_entry *jeb = b; > > - if (jea->key < jeb->key) > + if ((unsigned long)jump_entry_key(jea) < > + (unsigned long)jump_entry_key(jeb)) > return -1; > > - if (jea->key > jeb->key) > + if ((unsigned long)jump_entry_key(jea) > > + (unsigned long)jump_entry_key(jeb)) > return 1; I think you can ditch the unsigned long cast and directly compare pointers. That leads to much prettier code: if (jump_entry_key(jea) < jump_entry_key(jeb)) return -1; etc..