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


Groups > linux.kernel > #1601855 > unrolled thread

[PATCH 00/15] mm: page_alloc: style neatenings

Started byJoe Perches <joe@perches.com>
First post2017-03-16 03:10 +0100
Last post2017-03-16 11:40 +0100
Articles 11 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/15] mm: page_alloc: style neatenings Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
    [PATCH 03/15] mm: page_alloc: fix brace positions Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
    [PATCH 05/15] mm: page_alloc: Move __meminitdata and __initdata uses Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
    [PATCH 01/15] mm: page_alloc: whitespace neatening Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
    [PATCH 13/15] mm: page_alloc: Remove unnecessary parentheses Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
    [PATCH 15/15] mm: page_alloc: Move logical continuations to EOL Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
    [PATCH 12/15] mm: page_alloc: Avoid pointer comparisons to NULL Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
    [PATCH 10/15] mm: page_alloc: 80 column neatening Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
      Re: [PATCH 10/15] mm: page_alloc: 80 column neatening Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-16 10:00 +0100
    Re: [PATCH 02/15] mm: page_alloc: align arguments to parenthesis Joe Perches <joe@perches.com> - 2017-03-16 11:30 +0100
      Re: [PATCH 02/15] mm: page_alloc: align arguments to parenthesis Michal Hocko <mhocko@kernel.org> - 2017-03-16 11:40 +0100

#1601855 — [PATCH 00/15] mm: page_alloc: style neatenings

FromJoe Perches <joe@perches.com>
Date2017-03-16 03:10 +0100
Subject[PATCH 00/15] mm: page_alloc: style neatenings
Message-ID<tlt1v-8aE-3@gated-at.bofh.it>
Just neatening.  Maybe useful, maybe not.  Mostly whitespace changes.

There are still many checkpatch messages that should probably
be ignored.

Before:
$ ./scripts/checkpatch.pl --strict --terse --nosummary --show-types \
	-f mm/page_alloc.c | \
  cut -f4 -d":" | sort | uniq -c | sort -rn
    144 PARENTHESIS_ALIGNMENT
     38 SPLIT_STRING
     36 LINE_SPACING
     32 LONG_LINE
     28 SPACING
     14 LONG_LINE_COMMENT
     14 BRACES
     13 LOGGING_CONTINUATION
     12 PREFER_PR_LEVEL
      8 MISPLACED_INIT
      7 EXPORT_SYMBOL
      7 AVOID_BUG
      6 UNSPECIFIED_INT
      5 MACRO_ARG_PRECEDENCE
      4 MULTIPLE_ASSIGNMENTS
      4 LOGICAL_CONTINUATIONS
      4 COMPARISON_TO_NULL
      4 CAMELCASE
      3 UNNECESSARY_PARENTHESES
      3 PRINTK_WITHOUT_KERN_LEVEL
      3 MACRO_ARG_REUSE
      2 UNDOCUMENTED_SETUP
      2 MEMORY_BARRIER
      2 BLOCK_COMMENT_STYLE
      1 VOLATILE
      1 TYPO_SPELLING
      1 SYMBOLIC_PERMS
      1 SUSPECT_CODE_INDENT
      1 SPACE_BEFORE_TAB
      1 FUNCTION_ARGUMENTS
      1 CONSTANT_COMPARISON
      1 CONSIDER_KSTRTO

After:
$ ./scripts/checkpatch.pl --strict --terse --nosummary --show-types \
	-f mm/page_alloc.c | \
  cut -f4 -d":" | sort | uniq -c | sort -rn
     43 SPLIT_STRING
     21 LONG_LINE
     14 LONG_LINE_COMMENT
     13 LOGGING_CONTINUATION
     12 PREFER_PR_LEVEL
      8 PRINTK_WITHOUT_KERN_LEVEL
      7 AVOID_BUG
      5 MACRO_ARG_PRECEDENCE
      4 MULTIPLE_ASSIGNMENTS
      4 CAMELCASE
      3 MACRO_ARG_REUSE
      2 UNDOCUMENTED_SETUP
      2 MEMORY_BARRIER
      2 LEADING_SPACE
      1 VOLATILE
      1 SPACING
      1 FUNCTION_ARGUMENTS
      1 EXPORT_SYMBOL
      1 CONSTANT_COMPARISON
      1 CONSIDER_KSTRTO

Joe Perches (15):
  mm: page_alloc: whitespace neatening
  mm: page_alloc: align arguments to parenthesis
  mm: page_alloc: fix brace positions
  mm: page_alloc: fix blank lines
  mm: page_alloc: Move __meminitdata and __initdata uses
  mm: page_alloc: Use unsigned int instead of unsigned
  mm: page_alloc: Move labels to column 1
  mm: page_alloc: Fix typo acording -> according & the the -> to the
  mm: page_alloc: Use the common commenting style
  mm: page_alloc: 80 column neatening
  mm: page_alloc: Move EXPORT_SYMBOL uses
  mm: page_alloc: Avoid pointer comparisons to NULL
  mm: page_alloc: Remove unnecessary parentheses
  mm: page_alloc: Use octal permissions
  mm: page_alloc: Move logical continuations to EOL

 mm/page_alloc.c | 845 ++++++++++++++++++++++++++++++--------------------------
 1 file changed, 458 insertions(+), 387 deletions(-)

-- 
2.10.0.rc2.1.g053435c

[toc] | [next] | [standalone]


#1601857 — [PATCH 03/15] mm: page_alloc: fix brace positions

FromJoe Perches <joe@perches.com>
Date2017-03-16 03:10 +0100
Subject[PATCH 03/15] mm: page_alloc: fix brace positions
Message-ID<tlt1w-8aE-31@gated-at.bofh.it>
In reply to#1601855
Remove a few blank lines.

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 79fc996892c6..1029a1dd59d9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1375,7 +1375,6 @@ void set_zone_contiguous(struct zone *zone)
 	for (; block_start_pfn < zone_end_pfn(zone);
 	     block_start_pfn = block_end_pfn,
 		     block_end_pfn += pageblock_nr_pages) {
-
 		block_end_pfn = min(block_end_pfn, zone_end_pfn(zone));
 
 		if (!__pageblock_pfn_to_page(block_start_pfn,
@@ -4864,7 +4863,6 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask)
 	}
 
 	for_each_node_state(n, N_MEMORY) {
-
 		/* Don't want a node to appear more than once */
 		if (node_isset(n, *used_node_mask))
 			continue;
@@ -6437,7 +6435,6 @@ static void __init find_zone_movable_pfns_for_nodes(void)
 
 				/* Continue if range is now fully accounted */
 				if (end_pfn <= usable_startpfn) {
-
 					/*
 					 * Push zone_movable_pfn to the end so
 					 * that if we have to rebalance
@@ -6767,7 +6764,6 @@ void __init free_area_init(unsigned long *zones_size)
 
 static int page_alloc_cpu_dead(unsigned int cpu)
 {
-
 	lru_add_drain_cpu(cpu);
 	drain_pages(cpu);
 
@@ -6811,7 +6807,6 @@ static void calculate_totalreserve_pages(void)
 	enum zone_type i, j;
 
 	for_each_online_pgdat(pgdat) {
-
 		pgdat->totalreserve_pages = 0;
 
 		for (i = 0; i < MAX_NR_ZONES; i++) {
-- 
2.10.0.rc2.1.g053435c

[toc] | [prev] | [next] | [standalone]


#1601858 — [PATCH 05/15] mm: page_alloc: Move __meminitdata and __initdata uses

FromJoe Perches <joe@perches.com>
Date2017-03-16 03:10 +0100
Subject[PATCH 05/15] mm: page_alloc: Move __meminitdata and __initdata uses
Message-ID<tlt1w-8aE-15@gated-at.bofh.it>
In reply to#1601855
It's preferred to have these after the declarations.

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ec9832d15d07..2933a8a11927 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -262,16 +262,16 @@ int min_free_kbytes = 1024;
 int user_min_free_kbytes = -1;
 int watermark_scale_factor = 10;
 
-static unsigned long __meminitdata nr_kernel_pages;
-static unsigned long __meminitdata nr_all_pages;
-static unsigned long __meminitdata dma_reserve;
+static unsigned long nr_kernel_pages __meminitdata;
+static unsigned long nr_all_pages __meminitdata;
+static unsigned long dma_reserve __meminitdata;
 
 #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
-static unsigned long __meminitdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES];
-static unsigned long __meminitdata arch_zone_highest_possible_pfn[MAX_NR_ZONES];
-static unsigned long __initdata required_kernelcore;
-static unsigned long __initdata required_movablecore;
-static unsigned long __meminitdata zone_movable_pfn[MAX_NUMNODES];
+static unsigned long arch_zone_lowest_possible_pfn[MAX_NR_ZONES] __meminitdata;
+static unsigned long arch_zone_highest_possible_pfn[MAX_NR_ZONES] __meminitdata;
+static unsigned long required_kernelcore __initdata;
+static unsigned long required_movablecore __initdata;
+static unsigned long zone_movable_pfn[MAX_NUMNODES] __meminitdata;
 static bool mirrored_kernelcore;
 
 /* movable_zone is the "real" zone pages in ZONE_MOVABLE are taken from */
-- 
2.10.0.rc2.1.g053435c

[toc] | [prev] | [next] | [standalone]


#1601859 — [PATCH 01/15] mm: page_alloc: whitespace neatening

FromJoe Perches <joe@perches.com>
Date2017-03-16 03:10 +0100
Subject[PATCH 01/15] mm: page_alloc: whitespace neatening
Message-ID<tlt1w-8aE-29@gated-at.bofh.it>
In reply to#1601855
whitespace changes only - git diff -w shows no difference

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 54 +++++++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2d3c10734874..504749032400 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -202,7 +202,7 @@ static void __free_pages_ok(struct page *page, unsigned int order);
  * TBD: should special case ZONE_DMA32 machines here - in those we normally
  * don't need any ZONE_NORMAL reservation
  */
-int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
+int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES - 1] = {
 #ifdef CONFIG_ZONE_DMA
 	 256,
 #endif
@@ -366,7 +366,7 @@ static inline unsigned long *get_pageblock_bitmap(struct page *page,
 static inline int pfn_to_bitidx(struct page *page, unsigned long pfn)
 {
 #ifdef CONFIG_SPARSEMEM
-	pfn &= (PAGES_PER_SECTION-1);
+	pfn &= (PAGES_PER_SECTION - 1);
 	return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
 #else
 	pfn = pfn - round_down(page_zone(page)->zone_start_pfn, pageblock_nr_pages);
@@ -395,7 +395,7 @@ static __always_inline unsigned long __get_pfnblock_flags_mask(struct page *page
 	bitmap = get_pageblock_bitmap(page, pfn);
 	bitidx = pfn_to_bitidx(page, pfn);
 	word_bitidx = bitidx / BITS_PER_LONG;
-	bitidx &= (BITS_PER_LONG-1);
+	bitidx &= (BITS_PER_LONG - 1);
 
 	word = bitmap[word_bitidx];
 	bitidx += end_bitidx;
@@ -436,7 +436,7 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
 	bitmap = get_pageblock_bitmap(page, pfn);
 	bitidx = pfn_to_bitidx(page, pfn);
 	word_bitidx = bitidx / BITS_PER_LONG;
-	bitidx &= (BITS_PER_LONG-1);
+	bitidx &= (BITS_PER_LONG - 1);
 
 	VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
 
@@ -867,7 +867,7 @@ static inline void __free_one_page(struct page *page,
 	 * so it's less likely to be used soon and more likely to be merged
 	 * as a higher order page
 	 */
-	if ((order < MAX_ORDER-2) && pfn_valid_within(buddy_pfn)) {
+	if ((order < MAX_ORDER - 2) && pfn_valid_within(buddy_pfn)) {
 		struct page *higher_page, *higher_buddy;
 		combined_pfn = buddy_pfn & pfn;
 		higher_page = page + (combined_pfn - pfn);
@@ -1681,7 +1681,7 @@ static void check_new_page_bad(struct page *page)
 static inline int check_new_page(struct page *page)
 {
 	if (likely(page_expected_state(page,
-				PAGE_FLAGS_CHECK_AT_PREP|__PG_HWPOISON)))
+				PAGE_FLAGS_CHECK_AT_PREP | __PG_HWPOISON)))
 		return 0;
 
 	check_new_page_bad(page);
@@ -1899,7 +1899,7 @@ int move_freepages_block(struct zone *zone, struct page *page,
 	struct page *start_page, *end_page;
 
 	start_pfn = page_to_pfn(page);
-	start_pfn = start_pfn & ~(pageblock_nr_pages-1);
+	start_pfn = start_pfn & ~(pageblock_nr_pages - 1);
 	start_page = pfn_to_page(start_pfn);
 	end_page = start_page + pageblock_nr_pages - 1;
 	end_pfn = start_pfn + pageblock_nr_pages - 1;
@@ -2021,7 +2021,7 @@ static void steal_suitable_fallback(struct zone *zone, struct page *page,
 	 * If a sufficient number of pages in the block are either free or of
 	 * comparable migratability as our allocation, claim the whole block.
 	 */
-	if (free_pages + alike_pages >= (1 << (pageblock_order-1)) ||
+	if (free_pages + alike_pages >= (1 << (pageblock_order - 1)) ||
 			page_group_by_mobility_disabled)
 		set_pageblock_migratetype(page, start_type);
 
@@ -2205,8 +2205,8 @@ __rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype)
 	bool can_steal;
 
 	/* Find the largest possible block of pages in the other list */
-	for (current_order = MAX_ORDER-1;
-				current_order >= order && current_order <= MAX_ORDER-1;
+	for (current_order = MAX_ORDER - 1;
+				current_order >= order && current_order <= MAX_ORDER - 1;
 				--current_order) {
 		area = &(zone->free_area[current_order]);
 		fallback_mt = find_suitable_fallback(area, current_order,
@@ -3188,7 +3188,7 @@ __alloc_pages_cpuset_fallback(gfp_t gfp_mask, unsigned int order,
 	struct page *page;
 
 	page = get_page_from_freelist(gfp_mask, order,
-			alloc_flags|ALLOC_CPUSET, ac);
+			alloc_flags | ALLOC_CPUSET, ac);
 	/*
 	 * fallback to ignore cpuset restriction if our nodes
 	 * are depleted
@@ -3231,7 +3231,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
 	 * we're still under heavy pressure.
 	 */
 	page = get_page_from_freelist(gfp_mask | __GFP_HARDWALL, order,
-					ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac);
+					ALLOC_WMARK_HIGH | ALLOC_CPUSET, ac);
 	if (page)
 		goto out;
 
@@ -3518,7 +3518,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
 	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);
+	BUILD_BUG_ON(__GFP_HIGH != (__force gfp_t)ALLOC_HIGH);
 
 	/*
 	 * The caller may dip into page reserves a bit more if the caller
@@ -3526,7 +3526,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
 	 * policy or is asking for __GFP_HIGH memory.  GFP_ATOMIC requests will
 	 * set both ALLOC_HARDER (__GFP_ATOMIC) and ALLOC_HIGH (__GFP_HIGH).
 	 */
-	alloc_flags |= (__force int) (gfp_mask & __GFP_HIGH);
+	alloc_flags |= (__force int)(gfp_mask & __GFP_HIGH);
 
 	if (gfp_mask & __GFP_ATOMIC) {
 		/*
@@ -3642,7 +3642,7 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order,
 							NR_ZONE_WRITE_PENDING);
 
 				if (2 * write_pending > reclaimable) {
-					congestion_wait(BLK_RW_ASYNC, HZ/10);
+					congestion_wait(BLK_RW_ASYNC, HZ / 10);
 					return true;
 				}
 			}
@@ -3700,8 +3700,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	 * We also sanity check to catch abuse of atomic reserves being used by
 	 * callers that are not in atomic context.
 	 */
-	if (WARN_ON_ONCE((gfp_mask & (__GFP_ATOMIC|__GFP_DIRECT_RECLAIM)) ==
-				(__GFP_ATOMIC|__GFP_DIRECT_RECLAIM)))
+	if (WARN_ON_ONCE((gfp_mask & (__GFP_ATOMIC | __GFP_DIRECT_RECLAIM)) ==
+				(__GFP_ATOMIC | __GFP_DIRECT_RECLAIM)))
 		gfp_mask &= ~__GFP_ATOMIC;
 
 retry_cpuset:
@@ -3816,7 +3816,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	if (time_after(jiffies, alloc_start + stall_timeout)) {
 		warn_alloc(gfp_mask & ~__GFP_NOWARN, ac->nodemask,
 			"page allocation stalls for %ums, order:%u",
-			jiffies_to_msecs(jiffies-alloc_start), order);
+			jiffies_to_msecs(jiffies - alloc_start), order);
 		stall_timeout += 10 * HZ;
 	}
 
@@ -4063,7 +4063,7 @@ unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order)
 	page = alloc_pages(gfp_mask, order);
 	if (!page)
 		return 0;
-	return (unsigned long) page_address(page);
+	return (unsigned long)page_address(page);
 }
 EXPORT_SYMBOL(__get_free_pages);
 
@@ -4452,7 +4452,7 @@ static bool show_mem_node_skip(unsigned int flags, int nid, nodemask_t *nodemask
 	return !node_isset(nid, *nodemask);
 }
 
-#define K(x) ((x) << (PAGE_SHIFT-10))
+#define K(x) ((x) << (PAGE_SHIFT - 10))
 
 static void show_migration_types(unsigned char type)
 {
@@ -4754,7 +4754,7 @@ char numa_zonelist_order[16] = "default";
  * interface for configure zonelist ordering.
  * command line option "numa_zonelist_order"
  *	= "[dD]efault	- default, automatic configuration.
- *	= "[nN]ode 	- order by node locality, then by zone within node
+ *	= "[nN]ode	- order by node locality, then by zone within node
  *	= "[zZ]one      - order by zone, then by locality within zone
  */
 
@@ -4881,7 +4881,7 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask)
 			val += PENALTY_FOR_NODE_WITH_CPUS;
 
 		/* Slight preference for less loaded node */
-		val *= (MAX_NODE_LOAD*MAX_NUMNODES);
+		val *= (MAX_NODE_LOAD * MAX_NUMNODES);
 		val += node_load[n];
 
 		if (val < min_val) {
@@ -5381,7 +5381,7 @@ static int zone_batchsize(struct zone *zone)
 	 * of pages of one half of the possible page colors
 	 * and the other with pages of the other colors.
 	 */
-	batch = rounddown_pow_of_two(batch + batch/2) - 1;
+	batch = rounddown_pow_of_two(batch + batch / 2) - 1;
 
 	return batch;
 
@@ -5914,7 +5914,7 @@ static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned l
 {
 	unsigned long usemapsize;
 
-	zonesize += zone_start_pfn & (pageblock_nr_pages-1);
+	zonesize += zone_start_pfn & (pageblock_nr_pages - 1);
 	usemapsize = roundup(zonesize, pageblock_nr_pages);
 	usemapsize = usemapsize >> pageblock_order;
 	usemapsize *= NR_PAGEBLOCK_BITS;
@@ -7224,7 +7224,7 @@ void *__init alloc_large_system_hash(const char *tablename,
 
 		/* It isn't necessary when PAGE_SIZE >= 1MB */
 		if (PAGE_SHIFT < 20)
-			numentries = round_up(numentries, (1<<20)/PAGE_SIZE);
+			numentries = round_up(numentries, (1 << 20) / PAGE_SIZE);
 
 		if (flags & HASH_ADAPT) {
 			unsigned long adapt;
@@ -7345,7 +7345,7 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
 		 * handle each tail page individually in migration.
 		 */
 		if (PageHuge(page)) {
-			iter = round_up(iter + 1, 1<<compound_order(page)) - 1;
+			iter = round_up(iter + 1, 1 << compound_order(page)) - 1;
 			continue;
 		}
 
@@ -7718,7 +7718,7 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
 		rmv_page_order(page);
 		zone->free_area[order].nr_free--;
 		for (i = 0; i < (1 << order); i++)
-			SetPageReserved((page+i));
+			SetPageReserved((page + i));
 		pfn += (1 << order);
 	}
 	spin_unlock_irqrestore(&zone->lock, flags);
-- 
2.10.0.rc2.1.g053435c

[toc] | [prev] | [next] | [standalone]


#1601860 — [PATCH 13/15] mm: page_alloc: Remove unnecessary parentheses

FromJoe Perches <joe@perches.com>
Date2017-03-16 03:10 +0100
Subject[PATCH 13/15] mm: page_alloc: Remove unnecessary parentheses
Message-ID<tlt1w-8aE-37@gated-at.bofh.it>
In reply to#1601855
Just removing what isn't necessary for human comprehension.

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b6605b077053..efc3184aa6bc 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1806,7 +1806,7 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
 
 	/* Find a page of the appropriate size in the preferred list */
 	for (current_order = order; current_order < MAX_ORDER; ++current_order) {
-		area = &(zone->free_area[current_order]);
+		area = &zone->free_area[current_order];
 		page = list_first_entry_or_null(&area->free_list[migratetype],
 						struct page, lru);
 		if (!page)
@@ -2158,7 +2158,7 @@ static bool unreserve_highatomic_pageblock(const struct alloc_context *ac,
 
 		spin_lock_irqsave(&zone->lock, flags);
 		for (order = 0; order < MAX_ORDER; order++) {
-			struct free_area *area = &(zone->free_area[order]);
+			struct free_area *area = &zone->free_area[order];
 
 			page = list_first_entry_or_null(
 				&area->free_list[MIGRATE_HIGHATOMIC],
@@ -2228,7 +2228,7 @@ __rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype)
 	for (current_order = MAX_ORDER - 1;
 	     current_order >= order && current_order <= MAX_ORDER - 1;
 	     --current_order) {
-		area = &(zone->free_area[current_order]);
+		area = &zone->free_area[current_order];
 		fallback_mt = find_suitable_fallback(area, current_order,
 						     start_migratetype, false,
 						     &can_steal);
-- 
2.10.0.rc2.1.g053435c

[toc] | [prev] | [next] | [standalone]


#1601863 — [PATCH 15/15] mm: page_alloc: Move logical continuations to EOL

FromJoe Perches <joe@perches.com>
Date2017-03-16 03:10 +0100
Subject[PATCH 15/15] mm: page_alloc: Move logical continuations to EOL
Message-ID<tlt1w-8aE-41@gated-at.bofh.it>
In reply to#1601855
Just more code style conformance/neatening.

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 930773b03b26..011a8e057639 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -859,9 +859,9 @@ static inline void __free_one_page(struct page *page,
 			buddy = page + (buddy_pfn - pfn);
 			buddy_mt = get_pageblock_migratetype(buddy);
 
-			if (migratetype != buddy_mt
-			    && (is_migrate_isolate(migratetype) ||
-				is_migrate_isolate(buddy_mt)))
+			if (migratetype != buddy_mt &&
+			    (is_migrate_isolate(migratetype) ||
+			     is_migrate_isolate(buddy_mt)))
 				goto done_merging;
 		}
 		max_order++;
@@ -2115,8 +2115,9 @@ static void reserve_highatomic_pageblock(struct page *page, struct zone *zone,
 
 	/* Yoink! */
 	mt = get_pageblock_migratetype(page);
-	if (!is_migrate_highatomic(mt) && !is_migrate_isolate(mt)
-	    && !is_migrate_cma(mt)) {
+	if (!is_migrate_highatomic(mt) &&
+	    !is_migrate_isolate(mt) &&
+	    !is_migrate_cma(mt)) {
 		zone->nr_reserved_highatomic += pageblock_nr_pages;
 		set_pageblock_migratetype(page, MIGRATE_HIGHATOMIC);
 		move_freepages_block(zone, page, MIGRATE_HIGHATOMIC, NULL);
@@ -2682,8 +2683,9 @@ int __isolate_free_page(struct page *page, unsigned int order)
 		for (; page < endpage; page += pageblock_nr_pages) {
 			int mt = get_pageblock_migratetype(page);
 
-			if (!is_migrate_isolate(mt) && !is_migrate_cma(mt)
-			    && !is_migrate_highatomic(mt))
+			if (!is_migrate_isolate(mt) &&
+			    !is_migrate_cma(mt) &&
+			    !is_migrate_highatomic(mt))
 				set_pageblock_migratetype(page,
 							  MIGRATE_MOVABLE);
 		}
@@ -3791,8 +3793,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	 */
 	if (can_direct_reclaim &&
 	    (costly_order ||
-	     (order > 0 && ac->migratetype != MIGRATE_MOVABLE))
-	    && !gfp_pfmemalloc_allowed(gfp_mask)) {
+	     (order > 0 && ac->migratetype != MIGRATE_MOVABLE)) &&
+	    !gfp_pfmemalloc_allowed(gfp_mask)) {
 		page = __alloc_pages_direct_compact(gfp_mask, order,
 						    alloc_flags, ac,
 						    INIT_COMPACT_PRIORITY,
-- 
2.10.0.rc2.1.g053435c

[toc] | [prev] | [next] | [standalone]


#1601864 — [PATCH 12/15] mm: page_alloc: Avoid pointer comparisons to NULL

FromJoe Perches <joe@perches.com>
Date2017-03-16 03:10 +0100
Subject[PATCH 12/15] mm: page_alloc: Avoid pointer comparisons to NULL
Message-ID<tlt1x-8aE-45@gated-at.bofh.it>
In reply to#1601855
Use direct test instead.

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f9e6387c0ad4..b6605b077053 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -931,7 +931,7 @@ static void free_pages_check_bad(struct page *page)
 
 	if (unlikely(atomic_read(&page->_mapcount) != -1))
 		bad_reason = "nonzero mapcount";
-	if (unlikely(page->mapping != NULL))
+	if (unlikely(page->mapping))
 		bad_reason = "non-NULL mapping";
 	if (unlikely(page_ref_count(page) != 0))
 		bad_reason = "nonzero _refcount";
@@ -1668,7 +1668,7 @@ static void check_new_page_bad(struct page *page)
 
 	if (unlikely(atomic_read(&page->_mapcount) != -1))
 		bad_reason = "nonzero mapcount";
-	if (unlikely(page->mapping != NULL))
+	if (unlikely(page->mapping))
 		bad_reason = "non-NULL mapping";
 	if (unlikely(page_ref_count(page) != 0))
 		bad_reason = "nonzero _count";
@@ -2289,7 +2289,7 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
 	for (i = 0; i < count; ++i) {
 		struct page *page = __rmqueue(zone, order, migratetype);
 
-		if (unlikely(page == NULL))
+		if (unlikely(!page))
 			break;
 
 		if (unlikely(check_pcp_refill(page)))
@@ -4951,7 +4951,7 @@ static void build_zonelists_in_node_order(pg_data_t *pgdat, int node)
 	struct zonelist *zonelist;
 
 	zonelist = &pgdat->node_zonelists[ZONELIST_FALLBACK];
-	for (j = 0; zonelist->_zonerefs[j].zone != NULL; j++)
+	for (j = 0; zonelist->_zonerefs[j].zone; j++)
 		;
 	j = build_zonelists_node(NODE_DATA(node), zonelist, j);
 	zonelist->_zonerefs[j].zone = NULL;
-- 
2.10.0.rc2.1.g053435c

[toc] | [prev] | [next] | [standalone]


#1601865 — [PATCH 10/15] mm: page_alloc: 80 column neatening

FromJoe Perches <joe@perches.com>
Date2017-03-16 03:10 +0100
Subject[PATCH 10/15] mm: page_alloc: 80 column neatening
Message-ID<tlt1w-8aE-39@gated-at.bofh.it>
In reply to#1601855
Wrap some lines to make it easier to read.

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 259 ++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 157 insertions(+), 102 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3e1d377201b8..286b01b4c3e7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -383,10 +383,11 @@ static inline int pfn_to_bitidx(struct page *page, unsigned long pfn)
  *
  * Return: pageblock_bits flags
  */
-static __always_inline unsigned long __get_pfnblock_flags_mask(struct page *page,
-							       unsigned long pfn,
-							       unsigned long end_bitidx,
-							       unsigned long mask)
+static __always_inline
+unsigned long __get_pfnblock_flags_mask(struct page *page,
+					unsigned long pfn,
+					unsigned long end_bitidx,
+					unsigned long mask)
 {
 	unsigned long *bitmap;
 	unsigned long bitidx, word_bitidx;
@@ -409,9 +410,11 @@ unsigned long get_pfnblock_flags_mask(struct page *page, unsigned long pfn,
 	return __get_pfnblock_flags_mask(page, pfn, end_bitidx, mask);
 }
 
-static __always_inline int get_pfnblock_migratetype(struct page *page, unsigned long pfn)
+static __always_inline
+int get_pfnblock_migratetype(struct page *page, unsigned long pfn)
 {
-	return __get_pfnblock_flags_mask(page, pfn, PB_migrate_end, MIGRATETYPE_MASK);
+	return __get_pfnblock_flags_mask(page, pfn, PB_migrate_end,
+					 MIGRATETYPE_MASK);
 }
 
 /**
@@ -446,7 +449,8 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
 
 	word = READ_ONCE(bitmap[word_bitidx]);
 	for (;;) {
-		old_word = cmpxchg(&bitmap[word_bitidx], word, (word & ~mask) | flags);
+		old_word = cmpxchg(&bitmap[word_bitidx],
+				   word, (word & ~mask) | flags);
 		if (word == old_word)
 			break;
 		word = old_word;
@@ -533,9 +537,8 @@ static void bad_page(struct page *page, const char *reason,
 			goto out;
 		}
 		if (nr_unshown) {
-			pr_alert(
-				"BUG: Bad page state: %lu messages suppressed\n",
-				nr_unshown);
+			pr_alert("BUG: Bad page state: %lu messages suppressed\n",
+				 nr_unshown);
 			nr_unshown = 0;
 		}
 		nr_shown = 0;
@@ -600,8 +603,8 @@ void prep_compound_page(struct page *page, unsigned int order)
 
 #ifdef CONFIG_DEBUG_PAGEALLOC
 unsigned int _debug_guardpage_minorder;
-bool _debug_pagealloc_enabled __read_mostly
-= IS_ENABLED(CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT);
+bool _debug_pagealloc_enabled __read_mostly =
+	IS_ENABLED(CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT);
 EXPORT_SYMBOL(_debug_pagealloc_enabled);
 bool _debug_guardpage_enabled __read_mostly;
 
@@ -703,9 +706,15 @@ static inline void clear_page_guard(struct zone *zone, struct page *page,
 #else
 struct page_ext_operations debug_guardpage_ops;
 static inline bool set_page_guard(struct zone *zone, struct page *page,
-				  unsigned int order, int migratetype) { return false; }
+				  unsigned int order, int migratetype)
+{
+	return false;
+}
+
 static inline void clear_page_guard(struct zone *zone, struct page *page,
-				    unsigned int order, int migratetype) {}
+				    unsigned int order, int migratetype)
+{
+}
 #endif
 
 static inline void set_page_order(struct page *page, unsigned int order)
@@ -998,8 +1007,8 @@ static int free_tail_pages_check(struct page *head_page, struct page *page)
 	return ret;
 }
 
-static __always_inline bool free_pages_prepare(struct page *page,
-					       unsigned int order, bool check_free)
+static __always_inline
+bool free_pages_prepare(struct page *page, unsigned int order, bool check_free)
 {
 	int bad = 0;
 
@@ -1269,7 +1278,7 @@ static void __init __free_pages_boot_core(struct page *page, unsigned int order)
 }
 
 #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) ||	\
-	defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
+    defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
 
 static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata;
 
@@ -1289,8 +1298,9 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
 #endif
 
 #ifdef CONFIG_NODES_SPAN_OTHER_NODES
-static inline bool __meminit meminit_pfn_in_nid(unsigned long pfn, int node,
-						struct mminit_pfnnid_cache *state)
+static inline
+bool __meminit meminit_pfn_in_nid(unsigned long pfn, int node,
+				  struct mminit_pfnnid_cache *state)
 {
 	int nid;
 
@@ -1313,8 +1323,9 @@ static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
 	return true;
 }
 
-static inline bool __meminit meminit_pfn_in_nid(unsigned long pfn, int node,
-						struct mminit_pfnnid_cache *state)
+static inline
+bool __meminit meminit_pfn_in_nid(unsigned long pfn, int node,
+				  struct mminit_pfnnid_cache *state)
 {
 	return true;
 }
@@ -1564,7 +1575,8 @@ void __init page_alloc_init_late(void)
 	/* There will be num_node_state(N_MEMORY) threads */
 	atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY));
 	for_each_node_state(nid, N_MEMORY) {
-		kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid);
+		kthread_run(deferred_init_memmap, NODE_DATA(nid),
+			    "pgdatinit%d", nid);
 	}
 
 	/* Block until all are initialised */
@@ -1747,8 +1759,8 @@ inline void post_alloc_hook(struct page *page, unsigned int order,
 	set_page_owner(page, order, gfp_flags);
 }
 
-static void prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags,
-			  unsigned int alloc_flags)
+static void prep_new_page(struct page *page, unsigned int order,
+			  gfp_t gfp_flags, unsigned int alloc_flags)
 {
 	int i;
 	bool poisoned = true;
@@ -1835,7 +1847,10 @@ static struct page *__rmqueue_cma_fallback(struct zone *zone,
 }
 #else
 static inline struct page *__rmqueue_cma_fallback(struct zone *zone,
-						  unsigned int order) { return NULL; }
+						  unsigned int order)
+{
+	return NULL;
+}
 #endif
 
 /*
@@ -2216,7 +2231,8 @@ __rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype)
 	     --current_order) {
 		area = &(zone->free_area[current_order]);
 		fallback_mt = find_suitable_fallback(area, current_order,
-						     start_migratetype, false, &can_steal);
+						     start_migratetype, false,
+						     &can_steal);
 		if (fallback_mt == -1)
 			continue;
 
@@ -2780,9 +2796,11 @@ struct page *rmqueue(struct zone *preferred_zone,
 	do {
 		page = NULL;
 		if (alloc_flags & ALLOC_HARDER) {
-			page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
+			page = __rmqueue_smallest(zone, order,
+						  MIGRATE_HIGHATOMIC);
 			if (page)
-				trace_mm_page_alloc_zone_locked(page, order, migratetype);
+				trace_mm_page_alloc_zone_locked(page, order,
+								migratetype);
 		}
 		if (!page)
 			page = __rmqueue(zone, order, migratetype);
@@ -2966,7 +2984,8 @@ bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
 }
 
 static inline bool zone_watermark_fast(struct zone *z, unsigned int order,
-				       unsigned long mark, int classzone_idx, unsigned int alloc_flags)
+				       unsigned long mark, int classzone_idx,
+				       unsigned int alloc_flags)
 {
 	long free_pages = zone_page_state(z, NR_FREE_PAGES);
 	long cma_pages = 0;
@@ -2984,7 +3003,8 @@ static inline bool zone_watermark_fast(struct zone *z, unsigned int order,
 	 * the caller is !atomic then it'll uselessly search the free
 	 * list. That corner case is then slower but it is harmless.
 	 */
-	if (!order && (free_pages - cma_pages) > mark + z->lowmem_reserve[classzone_idx])
+	if (!order &&
+	    (free_pages - cma_pages) > mark + z->lowmem_reserve[classzone_idx])
 		return true;
 
 	return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags,
@@ -3081,7 +3101,8 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
 				goto try_this_zone;
 
 			if (node_reclaim_mode == 0 ||
-			    !zone_allows_reclaim(ac->preferred_zoneref->zone, zone))
+			    !zone_allows_reclaim(ac->preferred_zoneref->zone,
+						 zone))
 				continue;
 
 			ret = node_reclaim(zone->zone_pgdat, gfp_mask, order);
@@ -3095,7 +3116,8 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
 			default:
 				/* did we reclaim enough */
 				if (zone_watermark_ok(zone, order, mark,
-						      ac_classzone_idx(ac), alloc_flags))
+						      ac_classzone_idx(ac),
+						      alloc_flags))
 					goto try_this_zone;
 
 				continue;
@@ -3212,7 +3234,8 @@ __alloc_pages_cpuset_fallback(gfp_t gfp_mask, unsigned int order,
 
 static inline struct page *
 __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
-		      const struct alloc_context *ac, unsigned long *did_some_progress)
+		      const struct alloc_context *ac,
+		      unsigned long *did_some_progress)
 {
 	struct oom_control oc = {
 		.zonelist = ac->zonelist,
@@ -3280,7 +3303,8 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
 		 */
 		if (gfp_mask & __GFP_NOFAIL)
 			page = __alloc_pages_cpuset_fallback(gfp_mask, order,
-							     ALLOC_NO_WATERMARKS, ac);
+							     ALLOC_NO_WATERMARKS,
+							     ac);
 	}
 out:
 	mutex_unlock(&oom_lock);
@@ -3297,8 +3321,10 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
 /* Try memory compaction for high-order allocations before reclaim */
 static struct page *
 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
-			     unsigned int alloc_flags, const struct alloc_context *ac,
-			     enum compact_priority prio, enum compact_result *compact_result)
+			     unsigned int alloc_flags,
+			     const struct alloc_context *ac,
+			     enum compact_priority prio,
+			     enum compact_result *compact_result)
 {
 	struct page *page;
 
@@ -3413,16 +3439,18 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
 #else
 static inline struct page *
 __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
-			     unsigned int alloc_flags, const struct alloc_context *ac,
-			     enum compact_priority prio, enum compact_result *compact_result)
+			     unsigned int alloc_flags,
+			     const struct alloc_context *ac,
+			     enum compact_priority prio,
+			     enum compact_result *compact_result)
 {
 	*compact_result = COMPACT_SKIPPED;
 	return NULL;
 }
 
 static inline bool
-should_compact_retry(struct alloc_context *ac, unsigned int order, int alloc_flags,
-		     enum compact_result compact_result,
+should_compact_retry(struct alloc_context *ac, unsigned int order,
+		     int alloc_flags, enum compact_result compact_result,
 		     enum compact_priority *compact_priority,
 		     int *compaction_retries)
 {
@@ -3480,7 +3508,8 @@ __perform_reclaim(gfp_t gfp_mask, unsigned int order,
 /* 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,
-			     unsigned 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;
@@ -3522,8 +3551,7 @@ static void wake_all_kswapds(unsigned int order, const struct alloc_context *ac)
 	}
 }
 
-static inline unsigned int
-gfp_to_alloc_flags(gfp_t gfp_mask)
+static inline unsigned int gfp_to_alloc_flags(gfp_t gfp_mask)
 {
 	unsigned int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET;
 
@@ -3635,9 +3663,11 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned int order,
 		 * reclaimable pages?
 		 */
 		wmark = __zone_watermark_ok(zone, order, min_wmark,
-					    ac_classzone_idx(ac), alloc_flags, available);
+					    ac_classzone_idx(ac), alloc_flags,
+					    available);
 		trace_reclaim_retry_zone(z, order, reclaimable,
-					 available, min_wmark, *no_progress_loops, wmark);
+					 available, min_wmark,
+					 *no_progress_loops, wmark);
 		if (wmark) {
 			/*
 			 * If we didn't make any progress and have a lot of
@@ -3734,7 +3764,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	 * could end up iterating over non-eligible zones endlessly.
 	 */
 	ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
-						     ac->high_zoneidx, ac->nodemask);
+						     ac->high_zoneidx,
+						     ac->nodemask);
 	if (!ac->preferred_zoneref->zone)
 		goto nopage;
 
@@ -3807,10 +3838,12 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	 * These allocations are high priority and system rather than user
 	 * orientated.
 	 */
-	if (!(alloc_flags & ALLOC_CPUSET) || (alloc_flags & ALLOC_NO_WATERMARKS)) {
+	if (!(alloc_flags & ALLOC_CPUSET) ||
+	    (alloc_flags & ALLOC_NO_WATERMARKS)) {
 		ac->zonelist = node_zonelist(numa_node_id(), gfp_mask);
 		ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
-							     ac->high_zoneidx, ac->nodemask);
+							     ac->high_zoneidx,
+							     ac->nodemask);
 	}
 
 	/* Attempt with potentially adjusted zonelist and alloc_flags */
@@ -3939,7 +3972,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 		 * could deplete whole memory reserves which would just make
 		 * the situation worse
 		 */
-		page = __alloc_pages_cpuset_fallback(gfp_mask, order, ALLOC_HARDER, ac);
+		page = __alloc_pages_cpuset_fallback(gfp_mask, order,
+						     ALLOC_HARDER, ac);
 		if (page)
 			goto got_pg;
 
@@ -3953,10 +3987,11 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	return page;
 }
 
-static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
-				       struct zonelist *zonelist, nodemask_t *nodemask,
-				       struct alloc_context *ac, gfp_t *alloc_mask,
-				       unsigned int *alloc_flags)
+static inline
+bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
+			 struct zonelist *zonelist, nodemask_t *nodemask,
+			 struct alloc_context *ac, gfp_t *alloc_mask,
+			 unsigned int *alloc_flags)
 {
 	ac->high_zoneidx = gfp_zone(gfp_mask);
 	ac->zonelist = zonelist;
@@ -3997,7 +4032,8 @@ static inline void finalise_ac(gfp_t gfp_mask,
 	 * may get reset for allocations that ignore memory policies.
 	 */
 	ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
-						     ac->high_zoneidx, ac->nodemask);
+						     ac->high_zoneidx,
+						     ac->nodemask);
 }
 
 /*
@@ -4013,7 +4049,8 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
 	struct alloc_context ac = { };
 
 	gfp_mask &= gfp_allowed_mask;
-	if (!prepare_alloc_pages(gfp_mask, order, zonelist, nodemask, &ac, &alloc_mask, &alloc_flags))
+	if (!prepare_alloc_pages(gfp_mask, order, zonelist, nodemask, &ac,
+				 &alloc_mask, &alloc_flags))
 		return NULL;
 
 	finalise_ac(gfp_mask, order, &ac);
@@ -4448,7 +4485,8 @@ void si_meminfo_node(struct sysinfo *val, int nid)
  * Determine whether the node should be displayed or not, depending on whether
  * SHOW_MEM_FILTER_NODES was passed to show_free_areas().
  */
-static bool show_mem_node_skip(unsigned int flags, int nid, nodemask_t *nodemask)
+static bool show_mem_node_skip(unsigned int flags, int nid,
+			       nodemask_t *nodemask)
 {
 	if (!(flags & SHOW_MEM_FILTER_NODES))
 		return false;
@@ -5187,7 +5225,8 @@ static int __build_all_zonelists(void *data)
 		 * node/memory hotplug, we'll fixup all on-line cpus.
 		 */
 		if (cpu_online(cpu))
-			set_cpu_numa_mem(cpu, local_memory_node(cpu_to_node(cpu)));
+			set_cpu_numa_mem(cpu,
+					 local_memory_node(cpu_to_node(cpu)));
 #endif
 	}
 
@@ -5690,12 +5729,13 @@ static void __init find_usable_zone_for_movable(void)
  * highest usable zone for ZONE_MOVABLE. This preserves the assumption that
  * zones within a node are in order of monotonic increases memory addresses
  */
-static void __meminit adjust_zone_range_for_zone_movable(int nid,
-							 unsigned long zone_type,
-							 unsigned long node_start_pfn,
-							 unsigned long node_end_pfn,
-							 unsigned long *zone_start_pfn,
-							 unsigned long *zone_end_pfn)
+static void __meminit
+adjust_zone_range_for_zone_movable(int nid,
+				   unsigned long zone_type,
+				   unsigned long node_start_pfn,
+				   unsigned long node_end_pfn,
+				   unsigned long *zone_start_pfn,
+				   unsigned long *zone_end_pfn)
 {
 	/* Only adjust if ZONE_MOVABLE is on this node */
 	if (zone_movable_pfn[nid]) {
@@ -5721,13 +5761,14 @@ static void __meminit adjust_zone_range_for_zone_movable(int nid,
  * Return the number of pages a zone spans in a node, including holes
  * present_pages = zone_spanned_pages_in_node() - zone_absent_pages_in_node()
  */
-static unsigned long __meminit zone_spanned_pages_in_node(int nid,
-							  unsigned long zone_type,
-							  unsigned long node_start_pfn,
-							  unsigned long node_end_pfn,
-							  unsigned long *zone_start_pfn,
-							  unsigned long *zone_end_pfn,
-							  unsigned long *ignored)
+static unsigned long __meminit
+zone_spanned_pages_in_node(int nid,
+			   unsigned long zone_type,
+			   unsigned long node_start_pfn,
+			   unsigned long node_end_pfn,
+			   unsigned long *zone_start_pfn,
+			   unsigned long *zone_end_pfn,
+			   unsigned long *ignored)
 {
 	/* When hotadd a new node from cpu_up(), the node should be empty */
 	if (!node_start_pfn && !node_end_pfn)
@@ -5786,11 +5827,12 @@ unsigned long __init absent_pages_in_range(unsigned long start_pfn,
 }
 
 /* Return the number of page frames in holes in a zone on a node */
-static unsigned long __meminit zone_absent_pages_in_node(int nid,
-							 unsigned long zone_type,
-							 unsigned long node_start_pfn,
-							 unsigned long node_end_pfn,
-							 unsigned long *ignored)
+static unsigned long __meminit
+zone_absent_pages_in_node(int nid,
+			  unsigned long zone_type,
+			  unsigned long node_start_pfn,
+			  unsigned long node_end_pfn,
+			  unsigned long *ignored)
 {
 	unsigned long zone_low = arch_zone_lowest_possible_pfn[zone_type];
 	unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type];
@@ -5843,13 +5885,14 @@ static unsigned long __meminit zone_absent_pages_in_node(int nid,
 }
 
 #else /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
-static inline unsigned long __meminit zone_spanned_pages_in_node(int nid,
-								 unsigned long zone_type,
-								 unsigned long node_start_pfn,
-								 unsigned long node_end_pfn,
-								 unsigned long *zone_start_pfn,
-								 unsigned long *zone_end_pfn,
-								 unsigned long *zones_size)
+static inline unsigned long __meminit
+zone_spanned_pages_in_node(int nid,
+			   unsigned long zone_type,
+			   unsigned long node_start_pfn,
+			   unsigned long node_end_pfn,
+			   unsigned long *zone_start_pfn,
+			   unsigned long *zone_end_pfn,
+			   unsigned long *zones_size)
 {
 	unsigned int zone;
 
@@ -5862,11 +5905,12 @@ static inline unsigned long __meminit zone_spanned_pages_in_node(int nid,
 	return zones_size[zone_type];
 }
 
-static inline unsigned long __meminit zone_absent_pages_in_node(int nid,
-								unsigned long zone_type,
-								unsigned long node_start_pfn,
-								unsigned long node_end_pfn,
-								unsigned long *zholes_size)
+static inline unsigned long __meminit
+zone_absent_pages_in_node(int nid,
+			  unsigned long zone_type,
+			  unsigned long node_start_pfn,
+			  unsigned long node_end_pfn,
+			  unsigned long *zholes_size)
 {
 	if (!zholes_size)
 		return 0;
@@ -5924,7 +5968,8 @@ static void __meminit calculate_node_totalpages(struct pglist_data *pgdat,
  * round what is now in bits to nearest long in bits, then return it in
  * bytes.
  */
-static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned long zonesize)
+static unsigned long __init usemap_size(unsigned long zone_start_pfn,
+					unsigned long zonesize)
 {
 	unsigned long usemapsize;
 
@@ -6158,7 +6203,8 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
 }
 
 void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
-				      unsigned long node_start_pfn, unsigned long *zholes_size)
+				      unsigned long node_start_pfn,
+				      unsigned long *zholes_size)
 {
 	pg_data_t *pgdat = NODE_DATA(nid);
 	unsigned long start_pfn = 0;
@@ -7028,7 +7074,8 @@ core_initcall(init_per_zone_wmark_min)
  *	changes.
  */
 int min_free_kbytes_sysctl_handler(struct ctl_table *table, int write,
-				   void __user *buffer, size_t *length, loff_t *ppos)
+				   void __user *buffer, size_t *length,
+				   loff_t *ppos)
 {
 	int rc;
 
@@ -7044,7 +7091,8 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *table, int write,
 }
 
 int watermark_scale_factor_sysctl_handler(struct ctl_table *table, int write,
-					  void __user *buffer, size_t *length, loff_t *ppos)
+					  void __user *buffer, size_t *length,
+					  loff_t *ppos)
 {
 	int rc;
 
@@ -7068,8 +7116,8 @@ static void setup_min_unmapped_ratio(void)
 		pgdat->min_unmapped_pages = 0;
 
 	for_each_zone(zone)
-		zone->zone_pgdat->min_unmapped_pages += (zone->managed_pages *
-							 sysctl_min_unmapped_ratio) / 100;
+		zone->zone_pgdat->min_unmapped_pages +=
+			(zone->managed_pages * sysctl_min_unmapped_ratio) / 100;
 }
 
 int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write,
@@ -7095,12 +7143,13 @@ static void setup_min_slab_ratio(void)
 		pgdat->min_slab_pages = 0;
 
 	for_each_zone(zone)
-		zone->zone_pgdat->min_slab_pages += (zone->managed_pages *
-						     sysctl_min_slab_ratio) / 100;
+		zone->zone_pgdat->min_slab_pages +=
+			(zone->managed_pages * sysctl_min_slab_ratio) / 100;
 }
 
 int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write,
-					 void __user *buffer, size_t *length, loff_t *ppos)
+					 void __user *buffer, size_t *length,
+					 loff_t *ppos)
 {
 	int rc;
 
@@ -7124,7 +7173,8 @@ int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write,
  * if in function of the boot time zone sizes.
  */
 int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, int write,
-					void __user *buffer, size_t *length, loff_t *ppos)
+					void __user *buffer, size_t *length,
+					loff_t *ppos)
 {
 	proc_dointvec_minmax(table, write, buffer, length, ppos);
 	setup_per_zone_lowmem_reserve();
@@ -7137,7 +7187,8 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, int write,
  * pagelist can have before it gets flushed back to buddy allocator.
  */
 int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *table, int write,
-					    void __user *buffer, size_t *length, loff_t *ppos)
+					    void __user *buffer, size_t *length,
+					    loff_t *ppos)
 {
 	struct zone *zone;
 	int old_percpu_pagelist_fraction;
@@ -7167,7 +7218,8 @@ int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *table, int write,
 
 		for_each_possible_cpu(cpu)
 			pageset_set_high_and_batch(zone,
-						   per_cpu_ptr(zone->pageset, cpu));
+						   per_cpu_ptr(zone->pageset,
+							       cpu));
 	}
 out:
 	mutex_unlock(&pcp_batch_high_lock);
@@ -7238,7 +7290,8 @@ void *__init alloc_large_system_hash(const char *tablename,
 
 		/* It isn't necessary when PAGE_SIZE >= 1MB */
 		if (PAGE_SHIFT < 20)
-			numentries = round_up(numentries, (1 << 20) / PAGE_SIZE);
+			numentries = round_up(numentries,
+					      (1 << 20) / PAGE_SIZE);
 
 		if (flags & HASH_ADAPT) {
 			unsigned long adapt;
@@ -7359,7 +7412,8 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
 		 * handle each tail page individually in migration.
 		 */
 		if (PageHuge(page)) {
-			iter = round_up(iter + 1, 1 << compound_order(page)) - 1;
+			iter = round_up(iter + 1,
+					1 << compound_order(page)) - 1;
 			continue;
 		}
 
@@ -7429,7 +7483,8 @@ bool is_pageblock_removable_nolock(struct page *page)
 	return !has_unmovable_pages(zone, page, 0, true);
 }
 
-#if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA)
+#if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || \
+     defined(CONFIG_CMA)
 
 static unsigned long pfn_max_align_down(unsigned long pfn)
 {
-- 
2.10.0.rc2.1.g053435c

[toc] | [prev] | [next] | [standalone]


#1602100 — Re: [PATCH 10/15] mm: page_alloc: 80 column neatening

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2017-03-16 10:00 +0100
SubjectRe: [PATCH 10/15] mm: page_alloc: 80 column neatening
Message-ID<tlzqi-4aX-19@gated-at.bofh.it>
In reply to#1601865
On (03/15/17 19:00), Joe Perches wrote:
> Wrap some lines to make it easier to read.

hm, I thought that the general rule was "don't fix styles in the
code that left /staging". because it adds noise, messes with git
annotate, etc.

	-ss

[toc] | [prev] | [next] | [standalone]


#1602159 — Re: [PATCH 02/15] mm: page_alloc: align arguments to parenthesis

FromJoe Perches <joe@perches.com>
Date2017-03-16 11:30 +0100
SubjectRe: [PATCH 02/15] mm: page_alloc: align arguments to parenthesis
Message-ID<tlAPo-5jO-11@gated-at.bofh.it>
In reply to#1601855
On Thu, 2017-03-16 at 09:02 +0100, Michal Hocko wrote:
> On Wed 15-03-17 18:59:59, Joe Perches wrote:
> > whitespace changes only - git diff -w shows no difference
> 
> what is the point of this whitespace noise? Does it help readability?

Yes.  Consistency helps.

> To be honest I do not think so.

Opinions always vary.

>  Such a patch would make sense only if it
> was a part of a larger series where other patches would actually do
> something useful.

Do please read the 0/n introduction to this series.

And do remember to always strip the useless stuff you
unnecessarily quoted too.  66kb in this case.

There was a separate patch series 0/3 that actually did
the more useful stuff.

This patch series was purposely separated.

[toc] | [prev] | [next] | [standalone]


#1602166 — Re: [PATCH 02/15] mm: page_alloc: align arguments to parenthesis

FromMichal Hocko <mhocko@kernel.org>
Date2017-03-16 11:40 +0100
SubjectRe: [PATCH 02/15] mm: page_alloc: align arguments to parenthesis
Message-ID<tlAZ3-5nr-15@gated-at.bofh.it>
In reply to#1602159
On Thu 16-03-17 03:29:27, Joe Perches wrote:
> On Thu, 2017-03-16 at 09:02 +0100, Michal Hocko wrote:
> > On Wed 15-03-17 18:59:59, Joe Perches wrote:
> > > whitespace changes only - git diff -w shows no difference
> > 
> > what is the point of this whitespace noise? Does it help readability?
> 
> Yes.  Consistency helps.

Causing context conflicts doesn't though.

> > To be honest I do not think so.
> 
> Opinions always vary.

Yes the vary and I do not like this. If you find somebody to ack then I
will not complain but I would appreciate if a more useful stuff was done
in mm/page_alloc.c
-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web