From: Andrew Morton <akpm@linux-foundation.org>
To: Yu Zhao <yuzhao@google.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Michal Hocko <mhocko@suse.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Jerome Marchand <jmarchan@redhat.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: use unsigned long constant for page flags
Date: Fri, 29 Apr 2016 16:21:22 -0700 [thread overview]
Message-ID: <20160429162122.a293c7879bd06991f845ea97@linux-foundation.org> (raw)
In-Reply-To: <1461971723-16187-1-git-send-email-yuzhao@google.com>
On Fri, 29 Apr 2016 16:15:23 -0700 Yu Zhao <yuzhao@google.com> 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.
prev parent reply other threads:[~2016-04-29 23:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 23:15 Yu Zhao
2016-04-29 23:21 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160429162122.a293c7879bd06991f845ea97@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dvlasenk@redhat.com \
--cc=jmarchan@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=yuzhao@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®