linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
To: Hui Su <sh_def@163.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux MM <linux-mm@kvack.org>,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/page_counter: use page_counter_read in page_counter_set_max
Date: Fri, 13 Nov 2020 16:10:34 +0100	[thread overview]
Message-ID: <CAM9Jb+hJsjSm-2JVe2JSXndif_hz03hFLvR+LjxPQUxQN+HH3A@mail.gmail.com> (raw)
In-Reply-To: <20201113141048.GA178922@rlk>

> use page_counter_read() in page_counter_set_max().
>
> Signed-off-by: Hui Su <sh_def@163.com>
> ---
>  mm/page_counter.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/page_counter.c b/mm/page_counter.c
> index b24a60b28bb0..c6860f51b6c6 100644
> --- a/mm/page_counter.c
> +++ b/mm/page_counter.c
> @@ -183,14 +183,14 @@ int page_counter_set_max(struct page_counter *counter, unsigned long nr_pages)
>                  * the limit, so if it sees the old limit, we see the
>                  * modified counter and retry.
>                  */
> -               usage = atomic_long_read(&counter->usage);
> +               usage = page_counter_read(counter);
>
>                 if (usage > nr_pages)
>                         return -EBUSY;
>
>                 old = xchg(&counter->max, nr_pages);
>
> -               if (atomic_long_read(&counter->usage) <= usage)
> +               if (page_counter_read(counter) <= usage)
>                         return 0;
>
>                 counter->max = old;

Reviewed-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>


      reply	other threads:[~2020-11-13 15:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 14:10 Hui Su
2020-11-13 15:10 ` Pankaj Gupta [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=CAM9Jb+hJsjSm-2JVe2JSXndif_hz03hFLvR+LjxPQUxQN+HH3A@mail.gmail.com \
    --to=pankaj.gupta.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sh_def@163.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox