Skip to contentSkip to conversation

mm: minor janitorial style cleanups

PATCH In review Christos Skarlos 2 participants 7 messages Sep 5 – Sep 7

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover mm: minor janitorial style cleanups

This patch series resolves various coding style issues flagged by checkpatch.pl across mmap.c , vmscan.c and hugetlb.c.

Changes in v2:
- Restored filename comment at the top of mmap.c.
- Restore <asm/...> headers in mmap.c as they are architecture-specific.
- Remove blank lines above VMA_ITERATORS and NODEMASK_ALLOC declarations.
- Fixed commit message typos.

Thanks for the thorough review and guidance. As a newcomer every feedback and advice is really valuable to my workflow.

(Note: Apologies for the stray huge_memory.c patch included in v1 by accident; this v2 series correctly focuses strictly on mmap, vmscan, and hugetlb.)

No functional changes are introduced.

Christos Skarlos (3):
mm/mmap: fix various coding style warnings mm/vmscan: fix various coding style warnings and errors mm/hugetlb: fix various coding style warnings.

 mm/hugetlb.c | 16 ++++++++++------
 mm/mmap.c    | 12 +++++++-----
 mm/vmscan.c  | 11 ++++++-----
 3 files changed, 23 insertions(+), 16 deletions(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH v2 1/3 mm/mmap: fix various coding style warnings

Resolve coding style warnings and errors flagged by checkpatch.pl script. Specifically:
- Add missing blank lines after variable declarations and replace spaces with tabs where needed.

No functional changes are introduced.

---
 mm/mmap.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
mm/mmap.c +7 -5
index 4bf26b0f1e6e..6016a43d3c37 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * mm/mmap.c
+ *mm/mmap.c
  *
  * Written by obz.
  *
@@ -526,9 +526,9 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
 			 * And don't attempt to combine with hugetlb for now.
 			 */
 			if (flags & (MAP_LOCKED | MAP_HUGETLB))
-			        return -EINVAL;
+				return -EINVAL;
 			if (vma_flags_can_grow(&vma_flags))
-			        return -EINVAL;
+				return -EINVAL;
 
 			/*
 			 * If the pages can be dropped, then it doesn't make
@@ -832,6 +832,7 @@ __get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
 				  = NULL;
 
 	unsigned long error = arch_mmap_check(addr, len, flags);
+
 	if (error)
 		return error;
 
@@ -1017,12 +1018,12 @@ struct vm_area_struct *find_extend_vma_locked(struct mm_struct *mm, unsigned lon
 
 #if defined(CONFIG_STACK_GROWSUP)
 
-#define vma_expand_up(vma,addr) expand_upwards(vma, addr)
+#define vma_expand_up(vma, addr) expand_upwards(vma, addr)
 #define vma_expand_down(vma, addr) (-EFAULT)
 
 #else
 
-#define vma_expand_up(vma,addr) (-EFAULT)
+#define vma_expand_up(vma, addr) (-EFAULT)
 #define vma_expand_down(vma, addr) expand_downwards(vma, addr)
 
 #endif
@@ -1454,6 +1455,7 @@ static vm_fault_t special_mapping_fault(struct vm_fault *vmf)
 
 	if (*pages) {
 		struct page *page = *pages;
+
 		get_page(page);
 		vmf->page = page;
 		return 0;
Signature · 1 line
2.55.0
#2 lore raw

PATCH v2 2/3 mm/vmscan: fix various coding style warnings and errors

In reply to Christos Skarlos

Resolve coding style issues flagged by checkpatch.pl script. Specifically:
- Add missing blank lines after variable declarations.
- Replace "unsigned" with "unsigned int".
- Replace spaces with tabs where possible.

No functional changes are introduced.

---
 mm/vmscan.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
mm/vmscan.c +6 -5
index f11491ee9ed5..e0df7268d989 100644
@@ -535,7 +535,7 @@ void reclaim_throttle(pg_data_t *pgdat, enum vmscan_throttle_state reason)
 	 * writeback to a slow device to excessive referenced folios at the tail
 	 * of the inactive LRU.
 	 */
-	switch(reason) {
+	switch (reason) {
 	case VMSCAN_THROTTLE_WRITEBACK:
 		timeout = HZ/10;
 
@@ -1529,6 +1529,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
 		VM_BUG_ON_FOLIO(folio_test_active(folio), folio);
 		if (!folio_test_mlocked(folio)) {
 			int type = folio_is_file_lru(folio);
+
 			folio_set_active(folio);
 			stat->nr_activate[type] += nr_pages;
 			count_memcg_folio_events(folio, PGACTIVATE, nr_pages);
@@ -2073,8 +2074,8 @@ static void shrink_active_list(unsigned long nr_to_scan,
 	LIST_HEAD(l_hold);	/* The folios which were snipped off */
 	LIST_HEAD(l_active);
 	LIST_HEAD(l_inactive);
-	unsigned nr_deactivate, nr_activate;
-	unsigned nr_rotated = 0;
+	unsigned int nr_deactivate, nr_activate;
+	unsigned int nr_rotated = 0;
 	bool file = is_file_lru(lru);
 	struct pglist_data *pgdat = lruvec_pgdat(lruvec);
 
@@ -2614,7 +2615,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
 	/*
 	 * If there is enough inactive page cache, we do not reclaim
 	 * anything from the anonymous working right now to make sure
-         * a streaming file access pattern doesn't cause swapping.
+	 * a streaming file access pattern doesn't cause swapping.
 	 */
 	if (sc->cache_trim_mode) {
 		scan_balance = SCAN_FILE;
@@ -7748,7 +7749,7 @@ static int __init kswapd_init(void)
 	int nid;
 
 	for_each_node_state(nid, N_MEMORY)
- 		kswapd_run(nid);
+		kswapd_run(nid);
 	register_sysctl_init("vm", vmscan_sysctl_table);
 	return 0;
 }
Signature · 1 line
2.55.0
#3 lore raw

PATCH v2 3/3 mm/hugetlb: fix various coding style warnings.

In reply to Christos Skarlos

Resolve coding style issues flagged by the checkpatch.pl script. Specifically:
- Fix block comment formatting to keep trailing '*/' on a separate line.
- Add missing blank lines after variable declarations.
- Remove unnecessary braces {} from single statement blocks.

No functional changes are introduced.

---
 mm/hugetlb.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
mm/hugetlb.c +10 -6
index 4f6f58bf3db6..3b00e76332ac 100644
@@ -145,7 +145,8 @@ static inline void unlock_or_release_subpool(struct hugepage_subpool *spool,
 
 	/* If no pages are used, and no other handles to the subpool
 	 * remain, give up any reservations based on minimum size and
-	 * free the subpool */
+	 * free the subpool
+	 */
 	spin_unlock_irqrestore(&spool->lock, irq_flags);
 
 	if (free_subpool) {
@@ -3700,6 +3701,7 @@ static void try_to_free_low(struct hstate *h, unsigned long count,
 	for_each_node_mask(i, *nodes_allowed) {
 		struct folio *folio, *next;
 		struct list_head *freel = &h->hugepage_freelists[i];
+
 		list_for_each_entry_safe(folio, next, freel, lru) {
 			if (count >= h->nr_huge_pages)
 				goto out;
@@ -4188,9 +4190,9 @@ void __init hugetlb_add_hstate(unsigned int order)
 	struct hstate *h;
 	unsigned long i;
 
-	if (size_to_hstate(PAGE_SIZE << order)) {
+	if (size_to_hstate(PAGE_SIZE << order))
 		return;
-	}
+
 	BUG_ON(hugetlb_max_hstate >= HUGE_MAX_HSTATE);
 	BUG_ON(order < order_base_2(__NR_USED_SUBPAGE));
 	WARN_ON(order > MAX_FOLIO_ORDER);
@@ -4832,11 +4834,11 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct folio *folio,
 	pte_t entry = folio_mk_pte(folio, vma->vm_page_prot);
 	unsigned int shift = huge_page_shift(hstate_vma(vma));
 
-	if (try_mkwrite && (vma->vm_flags & VM_WRITE)) {
+	if (try_mkwrite && (vma->vm_flags & VM_WRITE))
 		entry = pte_mkwrite_novma(pte_mkdirty(entry));
-	} else {
+	else
 		entry = pte_wrprotect(entry);
-	}
+
 	entry = pte_mkyoung(entry);
 	entry = arch_make_huge_pte(entry, shift, vma->vm_flags);
 
@@ -4919,6 +4921,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
 	last_addr_mask = hugetlb_mask_last_page(h);
 	for (addr = src_vma->vm_start; addr < src_vma->vm_end; addr += sz) {
 		spinlock_t *src_ptl, *dst_ptl;
+
 		src_pte = hugetlb_walk(src_vma, addr, sz);
 		if (!src_pte) {
 			addr |= last_addr_mask;
@@ -6321,6 +6324,7 @@ int hugetlb_mfill_atomic_pte(pte_t *dst_pte,
 		folio = alloc_hugetlb_folio(dst_vma, dst_addr, false);
 		if (IS_ERR(folio)) {
 			pte_t *actual_pte = hugetlb_walk(dst_vma, dst_addr, PMD_SIZE);
+
 			if (actual_pte) {
 				ret = -EEXIST;
 				goto out;
Signature · 1 line
2.55.0
#4 lore raw
In reply to Christos Skarlos
Quoted 2 lines · Christos Skarlos

This patch series resolves various coding style issues flagged by checkpatch.pl across mmap.c , vmscan.c and hugetlb.c.

Checkpatch is meant for avoiding the issues when submitting new patches, not to be run on the existing code to generate fixes just for the checkpatch issues. NAK

Quoted 25 lines

Changes in v2:
- Restored filename comment at the top of mmap.c.
- Restore <asm/...> headers in mmap.c as they are architecture-specific.
- Remove blank lines above VMA_ITERATORS and NODEMASK_ALLOC declarations.
- Fixed commit message typos.

Thanks for the thorough review and guidance. As a newcomer every feedback and advice is really valuable to my workflow.

(Note: Apologies for the stray huge_memory.c patch included in v1 by accident; this v2 series correctly focuses strictly on mmap, vmscan, and hugetlb.)

No functional changes are introduced.

Christos Skarlos (3):
mm/mmap: fix various coding style warnings mm/vmscan: fix various coding style warnings and errors mm/hugetlb: fix various coding style warnings.

 mm/hugetlb.c | 16 ++++++++++------
 mm/mmap.c    | 12 +++++++-----
 mm/vmscan.c  | 11 ++++++-----
 3 files changed, 23 insertions(+), 16 deletions(-)
#5 lore raw

Hey Vlastimil ,
Understood. Thanks for taking the time to explain the proper scope of the checkpathc.pl. I will drop this patch and keep the tool strictly for new code
submissions moving forward.

Στις Δευ 7 Σεπ 2026 στις 10:44 π.μ., ο/η Vlastimil Babka (SUSE) < [email protected]> έγραψε:

Quoted 37 lines · Christos Skarlos
Quoted 2 lines

This patch series resolves various coding style issues flagged by checkpatch.pl across mmap.c , vmscan.c and hugetlb.c.

Checkpatch is meant for avoiding the issues when submitting new patches, not
to be run on the existing code to generate fixes just for the checkpatch issues. NAK

Quoted 7 lines

Changes in v2:
- Restored filename comment at the top of mmap.c.
- Restore <asm/...> headers in mmap.c as they are architecture-specific.
- Remove blank lines above VMA_ITERATORS and NODEMASK_ALLOC declarations.
- Fixed commit message typos.

Quoted 5 lines

Thanks for the thorough review and guidance. As a newcomer every feedback and advice is really valuable to my workflow.

(Note: Apologies for the stray huge_memory.c patch included in v1 by accident; this v2 series correctly focuses strictly on mmap, vmscan, and

hugetlb.)

Quoted 13 lines

No functional changes are introduced.

Christos Skarlos (3):
mm/mmap: fix various coding style warnings mm/vmscan: fix various coding style warnings and errors mm/hugetlb: fix various coding style warnings.

 mm/hugetlb.c | 16 ++++++++++------
 mm/mmap.c    | 12 +++++++-----
 mm/vmscan.c  | 11 ++++++-----
 3 files changed, 23 insertions(+), 16 deletions(-)
#6 lore raw

Hey Vlastimil ,
Understood. Thanks for taking the time to explain the proper scope of the checkpathc.pl. I will drop this patch and keep the tool strictly for new code submissions moving forward.

Στις Δευ 7 Σεπ 2026 στις 11:58 π.μ., ο/η Christos Skarlos <[email protected]> έγραψε:

Quoted 42 lines

Hey Vlastimil ,
Understood. Thanks for taking the time to explain the proper scope of the checkpathc.pl. I will drop this patch and keep the tool strictly for new code submissions moving forward.

Στις Δευ 7 Σεπ 2026 στις 10:44 π.μ., ο/η Vlastimil Babka (SUSE) <[email protected]> έγραψε:

Quoted 35 lines · Christos Skarlos
Quoted 2 lines

This patch series resolves various coding style issues flagged by checkpatch.pl across mmap.c , vmscan.c and hugetlb.c.

Checkpatch is meant for avoiding the issues when submitting new patches, not to be run on the existing code to generate fixes just for the checkpatch issues. NAK

Quoted 25 lines

Changes in v2:
- Restored filename comment at the top of mmap.c.
- Restore <asm/...> headers in mmap.c as they are architecture-specific.
- Remove blank lines above VMA_ITERATORS and NODEMASK_ALLOC declarations.
- Fixed commit message typos.

Thanks for the thorough review and guidance. As a newcomer every feedback and advice is really valuable to my workflow.

(Note: Apologies for the stray huge_memory.c patch included in v1 by accident; this v2 series correctly focuses strictly on mmap, vmscan, and hugetlb.)

No functional changes are introduced.

Christos Skarlos (3):
mm/mmap: fix various coding style warnings mm/vmscan: fix various coding style warnings and errors mm/hugetlb: fix various coding style warnings.

 mm/hugetlb.c | 16 ++++++++++------
 mm/mmap.c    | 12 +++++++-----
 mm/vmscan.c  | 11 ++++++-----
 3 files changed, 23 insertions(+), 16 deletions(-)