[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20211110074440.13343-1-sj@kernel.org>
Date: Wed, 10 Nov 2021 07:44:40 +0000
From: SeongJae Park <sj@...nel.org>
To: Muchun Song <songmuchun@...edance.com>
Cc: Yihao Han <hanyihao@...o.com>, SeongJae Park <sj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>, kernel@...o.com
Subject: Re: [PATCH] mm/damon/vaddr: use swap() to make code cleaner
On Wed, 10 Nov 2021 12:15:57 +0800 Muchun Song <songmuchun@...edance.com> wrote:
> On Wed, Nov 10, 2021 at 11:32 AM Yihao Han <hanyihao@...o.com> wrote:
> >
> > Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> > opencoding it.
> >
> > Signed-off-by: Yihao Han <hanyihao@...o.com>
> > ---
> > mm/damon/vaddr.c | 6 +-----
> > 1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> > index 35fe49080ee9..414d9fb9c827 100644
> > --- a/mm/damon/vaddr.c
> > +++ b/mm/damon/vaddr.c
> > @@ -100,11 +100,7 @@ static unsigned long sz_range(struct damon_addr_range *r)
> > static void swap_ranges(struct damon_addr_range *r1,
> > struct damon_addr_range *r2)
> > {
> > - struct damon_addr_range tmp;
> > -
> > - tmp = *r1;
> > - *r1 = *r2;
> > - *r2 = tmp;
> > + swap(*r1, *r2);
>
> IMHO, I suggest removing swap_ranges() completely
> since it's only a wrapper of swap() after your changes.
> The caller can invoke swap() directly.
I also agree to Muchun.
Thanks,
SJ
>
> Thanks.
>
> > }
> >
> > /*
> > --
> > 2.17.1
> >
Powered by blists - more mailing lists