Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1249212

Re: [PATCH mmotm] mm: use unsigned int for page order fix 2

From Hugh Dickins <hughd@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH mmotm] mm: use unsigned int for page order fix 2
Date 2015-10-17 01:10 +0200
Message-ID <qkmim-45V-9@gated-at.bofh.it> (permalink)
References <qkm8G-3Ei-7@gated-at.bofh.it> <qkmim-45V-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 16 Oct 2015, Andrew Morton wrote:
> On Fri, 16 Oct 2015 15:51:34 -0700 (PDT) Hugh Dickins <hughd@google.com> wrote:
> 
> > Some configs now end up with MAX_ORDER and pageblock_order having
> > different types: silence compiler warning in __free_one_page().
> > 
> > ...
> >
> > @@ -679,7 +679,7 @@ static inline void __free_one_page(struc
> >  		 * pageblock. Without this, pageblock isolation
> >  		 * could cause incorrect freepage accounting.
> >  		 */
> > -		max_order = min(MAX_ORDER, pageblock_order + 1);
> > +		max_order = min_t(unsigned int, MAX_ORDER, pageblock_order + 1);
> >  	} else {
> >  		__mod_zone_freepage_state(zone, 1 << order, migratetype);
> >  	}
> 
> Well.  If we're ordaining that "page order has type uint" then can we
> do that more consistently?  Something like

Yes, if we are going this way, then it is better to be thorough than
patch around it as I did.  (But personally I think the exercise is a
waste of time, so I just took the quickest way out, sorry.)

Hugh

> 
> --- a/include/linux/mmzone.h~a
> +++ a/include/linux/mmzone.h
> @@ -21,9 +21,9 @@
>  
>  /* Free memory management - zoned buddy allocator.  */
>  #ifndef CONFIG_FORCE_MAX_ZONEORDER
> -#define MAX_ORDER 11
> +#define MAX_ORDER 11U
>  #else
> -#define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER
> +#define MAX_ORDER ((unsigned int)CONFIG_FORCE_MAX_ZONEORDER)
>  #endif
>  #define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1))
>  
> diff -puN include/linux/pageblock-flags.h~a include/linux/pageblock-flags.h
> --- a/include/linux/pageblock-flags.h~a
> +++ a/include/linux/pageblock-flags.h
> @@ -49,7 +49,7 @@ extern unsigned int pageblock_order;
>  #else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
>  
>  /* Huge pages are a constant size */
> -#define pageblock_order		HUGETLB_PAGE_ORDER
> +#define pageblock_order		((unsigned int)HUGETLB_PAGE_ORDER)
>  
>  #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
>  
> _
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH mmotm] mm: use unsigned int for page order fix 2 Hugh Dickins <hughd@google.com> - 2015-10-17 01:00 +0200
  Re: [PATCH mmotm] mm: use unsigned int for page order fix 2 Hugh Dickins <hughd@google.com> - 2015-10-17 01:10 +0200
  Re: [PATCH mmotm] mm: use unsigned int for page order fix 2 Andrew Morton <akpm@linux-foundation.org> - 2015-10-17 01:10 +0200

csiph-web