extern int fragmentation_index(struct zone *zone, unsigned int order);
 extern unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
-                       int alloc_flags, const struct alloc_context *ac,
-                       enum migrate_mode mode, int *contended);
+               unsigned int alloc_flags, const struct alloc_context *ac,
+               enum migrate_mode mode, int *contended);
 extern void compact_pgdat(pg_data_t *pgdat, int order);
 extern void reset_isolation_suitable(pg_data_t *pgdat);
 extern unsigned long compaction_suitable(struct zone *zone, int order,
-                                       int alloc_flags, int classzone_idx);
+               unsigned int alloc_flags, int classzone_idx);
 
 extern void defer_compaction(struct zone *zone, int order);
 extern bool compaction_deferred(struct zone *zone, int order);
 
  *   COMPACT_CONTINUE - If compaction should run now
  */
 static unsigned long __compaction_suitable(struct zone *zone, int order,
-                                       int alloc_flags, int classzone_idx)
+                                       unsigned int alloc_flags,
+                                       int classzone_idx)
 {
        int fragindex;
        unsigned long watermark;
 }
 
 unsigned long compaction_suitable(struct zone *zone, int order,
-                                       int alloc_flags, int classzone_idx)
+                                       unsigned int alloc_flags,
+                                       int classzone_idx)
 {
        unsigned long ret;
 
 
 static unsigned long compact_zone_order(struct zone *zone, int order,
                gfp_t gfp_mask, enum migrate_mode mode, int *contended,
-               int alloc_flags, int classzone_idx)
+               unsigned int alloc_flags, int classzone_idx)
 {
        unsigned long ret;
        struct compact_control cc = {
  * This is the main entry point for direct page compaction.
  */
 unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
-                       int alloc_flags, const struct alloc_context *ac,
-                       enum migrate_mode mode, int *contended)
+               unsigned int alloc_flags, const struct alloc_context *ac,
+               enum migrate_mode mode, int *contended)
 {
        int may_enter_fs = gfp_mask & __GFP_FS;
        int may_perform_io = gfp_mask & __GFP_IO;
 
 }
 
 static int prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags,
-                                                               int alloc_flags)
+                                                       unsigned int alloc_flags)
 {
        int i;
        bool poisoned = true;
 static inline
 struct page *buffered_rmqueue(struct zone *preferred_zone,
                        struct zone *zone, unsigned int order,
-                       gfp_t gfp_flags, int alloc_flags, int migratetype)
+                       gfp_t gfp_flags, unsigned int alloc_flags,
+                       int migratetype)
 {
        unsigned long flags;
        struct page *page;
  * to check in the allocation paths if no pages are free.
  */
 static bool __zone_watermark_ok(struct zone *z, unsigned int order,
-                       unsigned long mark, int classzone_idx, int alloc_flags,
+                       unsigned long mark, int classzone_idx,
+                       unsigned int alloc_flags,
                        long free_pages)
 {
        long min = mark;
        int o;
-       const int alloc_harder = (alloc_flags & ALLOC_HARDER);
+       const bool alloc_harder = (alloc_flags & ALLOC_HARDER);
 
        /* free_pages may go negative - that's OK */
        free_pages -= (1 << order) - 1;
 }
 
 bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
-                     int classzone_idx, int alloc_flags)
+                     int classzone_idx, unsigned int alloc_flags)
 {
        return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags,
                                        zone_page_state(z, NR_FREE_PAGES));
 /* Try memory compaction for high-order allocations before reclaim */
 static struct page *
 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
-               int alloc_flags, const struct alloc_context *ac,
+               unsigned int alloc_flags, const struct alloc_context *ac,
                enum migrate_mode mode, int *contended_compaction,
                bool *deferred_compaction)
 {
 #else
 static inline struct page *
 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
-               int alloc_flags, const struct alloc_context *ac,
+               unsigned int alloc_flags, const struct alloc_context *ac,
                enum migrate_mode mode, int *contended_compaction,
                bool *deferred_compaction)
 {
 /* The really slow allocator path where we enter direct reclaim */
 static inline struct page *
 __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order,
-               int alloc_flags, const struct alloc_context *ac,
+               unsigned int alloc_flags, const struct alloc_context *ac,
                unsigned long *did_some_progress)
 {
        struct page *page = NULL;
                wakeup_kswapd(zone, order, zone_idx(ac->preferred_zone));
 }
 
-static inline int
+static inline unsigned int
 gfp_to_alloc_flags(gfp_t gfp_mask)
 {
-       int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET;
+       unsigned int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET;
 
        /* __GFP_HIGH is assumed to be the same as ALLOC_HIGH to save a branch. */
        BUILD_BUG_ON(__GFP_HIGH != (__force gfp_t) ALLOC_HIGH);
 {
        bool can_direct_reclaim = gfp_mask & __GFP_DIRECT_RECLAIM;
        struct page *page = NULL;
-       int alloc_flags;
+       unsigned int alloc_flags;
        unsigned long pages_reclaimed = 0;
        unsigned long did_some_progress;
        enum migrate_mode migration_mode = MIGRATE_ASYNC;
        struct zoneref *preferred_zoneref;
        struct page *page = NULL;
        unsigned int cpuset_mems_cookie;
-       int alloc_flags = ALLOC_WMARK_LOW|ALLOC_FAIR;
+       unsigned int alloc_flags = ALLOC_WMARK_LOW|ALLOC_FAIR;
        gfp_t alloc_mask; /* The gfp_t that was actually used for allocation */
        struct alloc_context ac = {
                .high_zoneidx = gfp_zone(gfp_mask),