From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752384AbcD2XVZ (ORCPT ); Fri, 29 Apr 2016 19:21:25 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46285 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbcD2XVY (ORCPT ); Fri, 29 Apr 2016 19:21:24 -0400 Date: Fri, 29 Apr 2016 16:21:22 -0700 From: Andrew Morton To: Yu Zhao Cc: "Kirill A . Shutemov" , Michal Hocko , Naoya Horiguchi , Jerome Marchand , Denys Vlasenko , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: use unsigned long constant for page flags Message-Id: <20160429162122.a293c7879bd06991f845ea97@linux-foundation.org> In-Reply-To: <1461971723-16187-1-git-send-email-yuzhao@google.com> References: <1461971723-16187-1-git-send-email-yuzhao@google.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Apr 2016 16:15:23 -0700 Yu Zhao wrote: > struct page->flags is unsigned long, so when shifting bits we should > use UL suffix to match it. > > Found this problem after I added 64-bit CPU specific page flags and > failed to compile the kernel: > mm/page_alloc.c: In function '__free_one_page': > mm/page_alloc.c:672:2: error: integer overflow in expression [-Werror=overflow] > Fair enough. > --- a/include/linux/page-flags.h > +++ b/include/linux/page-flags.h > @@ -474,7 +474,7 @@ static inline void ClearPageCompound(struct page *page) > } > #endif > > -#define PG_head_mask ((1L << PG_head)) > +#define PG_head_mask ((1UL << PG_head)) We do have the BIT() macro. I don't think it would add a lot of value here; I'd be OK with it either way.