pagevec.h: add `const` to pointer parameters of getter functions
PATCH v2 1/1 pagevec.h: add `const` to pointer parameters of getter functions
For improved const-correctness.
---v1->v2: reduced patch to just pagevec.h upon David Hildenbrand's suggestion
--- include/linux/pagevec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/pagevec.h +2 -2
@@ -51,12 +51,12 @@ static inline void folio_batch_reinit(struct folio_batch *fbatch) fbatch->i =0 ; } -static inline unsigned int folio_batch_count (struct folio_batch *fbatch) +static inline unsigned int folio_batch_count (const struct folio_batch *fbatch) {return fbatch->nr; } -static inline unsigned int folio_batch_space (struct folio_batch *fbatch) +static inline unsigned int folio_batch_space (const struct folio_batch *fbatch) {return PAGEVEC_SIZE - fbatch->nr; }
Signature · 1 line
2.47.2
Quoted 3 lines · Max Kellermann
For improved const-correctness.
Signed-off-by Max Kellermann <[email protected]>
I have a pending patch which constifies compound_order() and page_size() so you needn't bother with those.
Quoted 3 lines · Max Kellermann
For improved const-correctness.
Signed-off-by Max Kellermann <[email protected]>
Note that your Cc list is still not according to MAINTAINERS:
./scripts/get_maintainer.pl -f include/linux/pagevec.h
Andrew Morton <[email protected]> (maintainer:MEMORY MANAGEMENT - CORE) David Hildenbrand <[email protected]> (maintainer:MEMORY MANAGEMENT - CORE) Lorenzo Stoakes <[email protected]> (reviewer:MEMORY MANAGEMENT - CORE) "Liam R. Howlett" <[email protected]> (reviewer:MEMORY MANAGEMENT - CORE) Vlastimil Babka <[email protected]> (reviewer:MEMORY MANAGEMENT - CORE) Mike Rapoport <[email protected]> (reviewer:MEMORY MANAGEMENT - CORE) Suren Baghdasaryan <[email protected]> (reviewer:MEMORY MANAGEMENT - CORE) Michal Hocko <[email protected]> (reviewer:MEMORY MANAGEMENT - CORE) [email protected] (open list:MEMORY MANAGEMENT - CORE) [email protected] (open list)
Quoted 2 lines
---
v1->v2: reduced patch to justpagevec.hupon David Hildenbrand's suggestion
Assuming you don't intend to stop here, a series with multiple patches logically gradually expanding the const scope would be better than sending a single patch?
Thanks,
Vlastimil
Quoted 23 lines
--- include/linux/pagevec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/pagevec.h +2
-2@@ -51,12 +51,12 @@ static inline void folio_batch_reinit(struct folio_batch *fbatch) fbatch->i =0 ; } -static inline unsigned int folio_batch_count (struct folio_batch *fbatch) +static inline unsigned int folio_batch_count (const struct folio_batch *fbatch) {return fbatch->nr; } -static inline unsigned int folio_batch_space (struct folio_batch *fbatch) +static inline unsigned int folio_batch_space (const struct folio_batch *fbatch) {return PAGEVEC_SIZE - fbatch->nr; }
Quoted 1 line · Vlastimil Babka
Note that your Cc list is still not according to
MAINTAINERS:
I did, but I did this on 6.15... but master has significant additions to the MAINTAINERS file.
Quoted 2 lines
Assuming you don't intend to stop here, a series with multiple patches logically gradually expanding the const scope would be better than sending a single patch?
Yes, but that would mean more work, which I'm certainly willing to do, but only if I'm confident the patches are going to be accepted. So this tiny patch is a trial.
In v1, Lorenzo had expressed general objections to merging const-correctness patches.
I don't want to waste time with something that's going to be rejected anyway. I've been there so often, so often has there been one guy who just rejects my work, after similar patches (by others) had been merged.
+cc missing people.
Again, please run scripts/get_maintainers.pl and cc the right people, thanks.
Quoted 3 lines · Max Kellermann
For improved const-correctness.
Signed-off-by Max Kellermann <[email protected]>
This is fine, so:
Quoted 28 lines
---
v1->v2: reduced patch to justpagevec.hupon David Hildenbrand's suggestion--- include/linux/pagevec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/pagevec.h +2
-3@@ -51,12 +51,12 @@ static inline void folio_batch_reinit(struct folio_batch *fbatch) fbatch->i =0 ; } -static inline unsigned int folio_batch_count (struct folio_batch *fbatch) +static inline unsigned int folio_batch_count (const struct folio_batch *fbatch) {return fbatch->nr; } -static inline unsigned int folio_batch_space (struct folio_batch *fbatch) +static inline unsigned int folio_batch_space (const struct folio_batch *fbatch) {return PAGEVEC_SIZE - fbatch->nr; } --2.47.2
Quoted 3 lines · Max Kellermann
For improved const-correctness.
Signed-off-by Max Kellermann <[email protected]>
Quoted 3 lines · On Thu, 28 Aug 2025 15:03:11 +0200 Max Kellermann <[email protected]>…
For improved const-correctness.
Signed-off-by Max Kellermann <[email protected]>
Thanks,
SJ
[...]