From: SeongJae Park <sj@kernel.org>
To: Muchun Song <songmuchun@bytedance.com>
Cc: Yihao Han <hanyihao@vivo.com>, SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
kernel@vivo.com
Subject: Re: [PATCH] mm/damon/vaddr: use swap() to make code cleaner
Date: Wed, 10 Nov 2021 07:44:40 +0000 [thread overview]
Message-ID: <20211110074440.13343-1-sj@kernel.org> (raw)
In-Reply-To: <CAMZfGtXbSgLQD2MSda0YoXNUioAzVhQmH5YpSsFLZ0vSMiEHUg@mail.gmail.com>
On Wed, 10 Nov 2021 12:15:57 +0800 Muchun Song <songmuchun@bytedance.com> wrote:
> On Wed, Nov 10, 2021 at 11:32 AM Yihao Han <hanyihao@vivo.com> wrote:
> >
> > Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> > opencoding it.
> >
> > Signed-off-by: Yihao Han <hanyihao@vivo.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
> >
prev parent reply other threads:[~2021-11-10 7:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 3:32 [PATCH] mm/damon/vaddr: use swap() to make code cleaner Yihao Han
2021-11-10 4:15 ` Muchun Song
2021-11-10 7:44 ` SeongJae Park [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211110074440.13343-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hanyihao@vivo.com \
--cc=kernel@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=songmuchun@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.