* [PATCH v2 0/3] mm: minor janitorial style cleanups
@ 2026-09-05 18:31 Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 1/3] mm/mmap: fix various coding style warnings Christos Skarlos
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christos Skarlos @ 2026-09-05 18:31 UTC (permalink / raw)
To: akpm, david, muchun.song, osalvador, ljs, hannes
Cc: ziy, baolin.wang, liam, nico.pache, ryan.roberts, dev.jain,
baohua, lance.yang, usama.arif, kas, vbabka, jannh, pfalcato,
kasong, qi.zheng, shakeel.butt, axelrasmussen, yuanchu, weixugc,
mhocko, linux-mm, linux-kernel, Christos Skarlos
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(-)
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/3] mm/mmap: fix various coding style warnings
2026-09-05 18:31 [PATCH v2 0/3] mm: minor janitorial style cleanups Christos Skarlos
@ 2026-09-05 18:31 ` Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 2/3] mm/vmscan: fix various coding style warnings and errors Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 3/3] mm/hugetlb: fix various coding style warnings Christos Skarlos
2 siblings, 0 replies; 4+ messages in thread
From: Christos Skarlos @ 2026-09-05 18:31 UTC (permalink / raw)
To: akpm, david, muchun.song, osalvador, ljs, hannes
Cc: ziy, baolin.wang, liam, nico.pache, ryan.roberts, dev.jain,
baohua, lance.yang, usama.arif, kas, vbabka, jannh, pfalcato,
kasong, qi.zheng, shakeel.butt, axelrasmussen, yuanchu, weixugc,
mhocko, linux-mm, linux-kernel, Christos Skarlos
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.
Signed-off-by: Christos Skarlos <christosskarlos.kernel@gmail.com>
---
mm/mmap.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 4bf26b0f1e6e..6016a43d3c37 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -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;
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] mm/vmscan: fix various coding style warnings and errors
2026-09-05 18:31 [PATCH v2 0/3] mm: minor janitorial style cleanups Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 1/3] mm/mmap: fix various coding style warnings Christos Skarlos
@ 2026-09-05 18:31 ` Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 3/3] mm/hugetlb: fix various coding style warnings Christos Skarlos
2 siblings, 0 replies; 4+ messages in thread
From: Christos Skarlos @ 2026-09-05 18:31 UTC (permalink / raw)
To: akpm, david, muchun.song, osalvador, ljs, hannes
Cc: ziy, baolin.wang, liam, nico.pache, ryan.roberts, dev.jain,
baohua, lance.yang, usama.arif, kas, vbabka, jannh, pfalcato,
kasong, qi.zheng, shakeel.butt, axelrasmussen, yuanchu, weixugc,
mhocko, linux-mm, linux-kernel, 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.
Signed-off-by: Christos Skarlos <christosskarlos.kernel@gmail.com>
---
mm/vmscan.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f11491ee9ed5..e0df7268d989 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -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;
}
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] mm/hugetlb: fix various coding style warnings.
2026-09-05 18:31 [PATCH v2 0/3] mm: minor janitorial style cleanups Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 1/3] mm/mmap: fix various coding style warnings Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 2/3] mm/vmscan: fix various coding style warnings and errors Christos Skarlos
@ 2026-09-05 18:31 ` Christos Skarlos
2 siblings, 0 replies; 4+ messages in thread
From: Christos Skarlos @ 2026-09-05 18:31 UTC (permalink / raw)
To: akpm, david, muchun.song, osalvador, ljs, hannes
Cc: ziy, baolin.wang, liam, nico.pache, ryan.roberts, dev.jain,
baohua, lance.yang, usama.arif, kas, vbabka, jannh, pfalcato,
kasong, qi.zheng, shakeel.butt, axelrasmussen, yuanchu, weixugc,
mhocko, linux-mm, linux-kernel, 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.
Signed-off-by: Christos Skarlos <christosskarlos.kernel@gmail.com>
---
mm/hugetlb.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 4f6f58bf3db6..3b00e76332ac 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -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;
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-05 18:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-05 18:31 [PATCH v2 0/3] mm: minor janitorial style cleanups Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 1/3] mm/mmap: fix various coding style warnings Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 2/3] mm/vmscan: fix various coding style warnings and errors Christos Skarlos
2026-09-05 18:31 ` [PATCH v2 3/3] mm/hugetlb: fix various coding style warnings Christos Skarlos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®