For some project I had to use the pagewalk API for certain things and during
this have read through the code multiple times. Our usage has changed several
times depending on our current state of research as well.
During all of this I have made some tweaks to the code to be able to follow it
better when hunting my own problems, and not call into some things that I
actually don't need. The patches are more or less independent of each other.
Especially the last one may heavily depend on personal taste, so if you don't
like it, just ignore it.
I would welcome if you could just pick those that you think are fitting and
provide feedback on either of the remaining ones. At the end none of them
should make any functional difference.
Regards,
Eike
--
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055
emlix - smart embedded open source
These initializations accidentially got lost during refactoring.
The first one can't actually be used without initialization, because
walk_p4d_range() is only called when one of the 4 callbacks is set, but relying
on this seems fragile.
Reported-by: Linux Kernel Functional Testing <[email protected]>
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Rolf Eike Beer <[email protected]>
---
mm/pagewalk.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Looks like my testing had just the right callbacks set so I never hit this. In
case you want to have this squashed into the original one just drop me a note
and I'll redo the whole series.
diff --git a/mm/pagewalk.c b/mm/pagewalk.c
index d8be8a30b272..22e4bcca9bee 100644
--- a/mm/pagewalk.c
+++ b/mm/pagewalk.c
@@ -223,7 +223,7 @@ static int walk_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end,
p4d = p4d_offset(pgd, addr);
do {
- int err;
+ int err = 0;
next = p4d_addr_end(addr, end);
if (p4d_none_or_clear_bad(p4d)) {
@@ -262,7 +262,7 @@ static int walk_pgd_range(unsigned long addr, unsigned long end,
else
pgd = pgd_offset(walk->mm, addr);
do {
- int err;
+ int err = 0;
next = pgd_addr_end(addr, end);
if (pgd_none_or_clear_bad(pgd)) {
@@ -308,7 +308,7 @@ static int walk_hugetlb_range(unsigned long addr, unsigned long end,
const struct mm_walk_ops *ops = walk->ops;
for (; addr < end; addr = next) {
- int err;
+ int err = 0;
pte_t *pte = huge_pte_offset(walk->mm, addr & hmask, sz);
next = hugetlb_entry_end(h, addr, end);
--
2.37.2
--
Rolf Eike Beer, emlix GmbH, https://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055
emlix - smart embedded open source
On Wed, Aug 24, 2022 at 01:00:11PM +0200, Rolf Eike Beer wrote:
> These initializations accidentially got lost during refactoring.
>
> The first one can't actually be used without initialization, because
> walk_p4d_range() is only called when one of the 4 callbacks is set, but relying
> on this seems fragile.
>
> Reported-by: Linux Kernel Functional Testing <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
> Signed-off-by: Rolf Eike Beer <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
> ---
> mm/pagewalk.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> Looks like my testing had just the right callbacks set so I never hit this. In
> case you want to have this squashed into the original one just drop me a note
> and I'll redo the whole series.
>
> diff --git a/mm/pagewalk.c b/mm/pagewalk.c
> index d8be8a30b272..22e4bcca9bee 100644
> --- a/mm/pagewalk.c
> +++ b/mm/pagewalk.c
> @@ -223,7 +223,7 @@ static int walk_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end,
>
> p4d = p4d_offset(pgd, addr);
> do {
> - int err;
> + int err = 0;
>
> next = p4d_addr_end(addr, end);
> if (p4d_none_or_clear_bad(p4d)) {
> @@ -262,7 +262,7 @@ static int walk_pgd_range(unsigned long addr, unsigned long end,
> else
> pgd = pgd_offset(walk->mm, addr);
> do {
> - int err;
> + int err = 0;
>
> next = pgd_addr_end(addr, end);
> if (pgd_none_or_clear_bad(pgd)) {
> @@ -308,7 +308,7 @@ static int walk_hugetlb_range(unsigned long addr, unsigned long end,
> const struct mm_walk_ops *ops = walk->ops;
>
> for (; addr < end; addr = next) {
> - int err;
> + int err = 0;
> pte_t *pte = huge_pte_offset(walk->mm, addr & hmask, sz);
>
> next = hugetlb_entry_end(h, addr, end);
> --
> 2.37.2
>
> --
> Rolf Eike Beer, emlix GmbH, https://www.emlix.com
> Fon +49 551 30664-0, Fax +49 551 30664-11
> Gothaer Platz 3, 37083 Göttingen, Germany
> Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
> Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055
>
> emlix - smart embedded open source
>
>