* [PATCH mmotm] mm: use unsigned int for page order fix 2
@ 2015-10-16 22:51 Hugh Dickins
2015-10-16 23:00 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2015-10-16 22:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Kirill A. Shutemov, Stephen Rothwell, linux-kernel, linux-mm
Some configs now end up with MAX_ORDER and pageblock_order having
different types: silence compiler warning in __free_one_page().
Signed-off-by: Hugh Dickins <hughd@google.com>
--- mmotm/mm/page_alloc.c 2015-10-15 15:26:59.855572338 -0700
+++ linux/mm/page_alloc.c 2015-10-16 11:54:20.847027790 -0700
@@ -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);
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH mmotm] mm: use unsigned int for page order fix 2
2015-10-16 22:51 [PATCH mmotm] mm: use unsigned int for page order fix 2 Hugh Dickins
@ 2015-10-16 23:00 ` Andrew Morton
2015-10-16 23:07 ` Hugh Dickins
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2015-10-16 23:00 UTC (permalink / raw)
To: Hugh Dickins; +Cc: Kirill A. Shutemov, Stephen Rothwell, linux-kernel, linux-mm
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
--- 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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH mmotm] mm: use unsigned int for page order fix 2
2015-10-16 23:00 ` Andrew Morton
@ 2015-10-16 23:07 ` Hugh Dickins
0 siblings, 0 replies; 3+ messages in thread
From: Hugh Dickins @ 2015-10-16 23:07 UTC (permalink / raw)
To: Andrew Morton
Cc: Hugh Dickins, Kirill A. Shutemov, Stephen Rothwell, linux-kernel,
linux-mm
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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-16 23:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-16 22:51 [PATCH mmotm] mm: use unsigned int for page order fix 2 Hugh Dickins
2015-10-16 23:00 ` Andrew Morton
2015-10-16 23:07 ` Hugh Dickins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox