linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_counter: use page_counter_read in page_counter_set_max
@ 2020-11-13 14:10 Hui Su
  2020-11-13 15:10 ` Pankaj Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Su @ 2020-11-13 14:10 UTC (permalink / raw)
  To: akpm, linux-mm, linux-kernel; +Cc: sh_def

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;
-- 
2.29.0




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/page_counter: use page_counter_read in page_counter_set_max
  2020-11-13 14:10 [PATCH] mm/page_counter: use page_counter_read in page_counter_set_max Hui Su
@ 2020-11-13 15:10 ` Pankaj Gupta
  0 siblings, 0 replies; 2+ messages in thread
From: Pankaj Gupta @ 2020-11-13 15:10 UTC (permalink / raw)
  To: Hui Su; +Cc: Andrew Morton, Linux MM, LKML

> 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>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-13 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 14:10 [PATCH] mm/page_counter: use page_counter_read in page_counter_set_max Hui Su
2020-11-13 15:10 ` Pankaj Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox