[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z/0ZC7HcSmoOEglw@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com>
Date: Mon, 14 Apr 2025 16:17:47 +0200
From: Alexander Gordeev <agordeev@...ux.ibm.com>
To: Nicholas Piggin <npiggin@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
Hugh Dickins <hughd@...gle.com>, Guenter Roeck <linux@...ck-us.net>,
Juergen Gross <jgross@...e.com>, Jeremy Fitzhardinge <jeremy@...p.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
kasan-dev@...glegroups.com, sparclinux@...r.kernel.org,
xen-devel@...ts.xenproject.org, linuxppc-dev@...ts.ozlabs.org,
linux-s390@...r.kernel.org
Subject: Re: [PATCH v1 2/4] mm: Cleanup apply_to_pte_range() routine
On Fri, Apr 11, 2025 at 04:46:58PM +1000, Nicholas Piggin wrote:
> On Tue Apr 8, 2025 at 1:11 AM AEST, Alexander Gordeev wrote:
> > Reverse 'create' vs 'mm == &init_mm' conditions and move
> > page table mask modification out of the atomic context.
> >
> > Signed-off-by: Alexander Gordeev <agordeev@...ux.ibm.com>
> > ---
> > mm/memory.c | 28 +++++++++++++++++-----------
> > 1 file changed, 17 insertions(+), 11 deletions(-)
> >
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 2d8c265fc7d6..f0201c8ec1ce 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -2915,24 +2915,28 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
> > pte_fn_t fn, void *data, bool create,
> > pgtbl_mod_mask *mask)
> > {
> > + int err = create ? -ENOMEM : -EINVAL;
>
> Could you make this a new variable instead of reusing
> existing err? 'const int pte_err' or something?
Will do, when/if repost.
...
> > @@ -2944,12 +2948,14 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
> > }
> > } while (addr += PAGE_SIZE, addr != end);
> > }
> > - *mask |= PGTBL_PTE_MODIFIED;
> >
> > arch_leave_lazy_mmu_mode();
> >
> > if (mm != &init_mm)
> > pte_unmap_unlock(mapped_pte, ptl);
> > +
> > + *mask |= PGTBL_PTE_MODIFIED;
>
> This is done just because we might as well? Less work in critical
> section?
Yes.
Thanks!
Powered by blists - more mailing lists