From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755536AbbGTT0Z (ORCPT ); Mon, 20 Jul 2015 15:26:25 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:27002 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751580AbbGTT0X (ORCPT ); Mon, 20 Jul 2015 15:26:23 -0400 Date: Mon, 20 Jul 2015 21:25:31 +0200 From: Sowmini Varadhan To: Rasmus Villemoes Cc: Guenter Roeck , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, benh@kernel.crashing.org, davem@davemloft.net Subject: Re: [PATCH] iommu-common: Do not use 64 bit constant 0xffffffffffffffffl for computing align_mask Message-ID: <20150720192531.GB19855@oracle.com> References: <20150719121653.GA30645@oracle.com> <20150719152724.GB3729@roeck-us.net> <874mkzevz4.fsf@rasmusvillemoes.dk> <55AC55AD.6070608@roeck-us.net> <87oaj6ogox.fsf@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87oaj6ogox.fsf@rasmusvillemoes.dk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (07/20/15 19:57), Rasmus Villemoes wrote: > I highly doubt it. The result is truncated to unsigned long > anyway. Assuming align_order always has a value between 0 and > BITS_PER_LONG, GENMASK should be exactly what is wanted. While GENMASK may do the job, the code is already quite obscure, so I'm going to stick with the minimal delta to get this right, namely - align_mask = 0xffffffffffffffffl >> (64 - align_order); + align_mask = ~0ul >> (BITS_PER_LONG - align_order); --Sowmini