mm/page_counter: use page_counter_read in page_counter_set_max
authorHui Su <sh_def@163.com>
Tue, 15 Dec 2020 03:06:58 +0000 (19:06 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 15 Dec 2020 20:13:40 +0000 (12:13 -0800)
Use page_counter_read() in page_counter_set_max().

Link: https://lkml.kernel.org/r/20201113141048.GA178922@rlk
Signed-off-by: Hui Su <sh_def@163.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_counter.c

index b24a60b28bb0127be5b1d6cb19325efe8dfa70f9..c6860f51b6c6086be8d619ec49779602f4236203 100644 (file)
@@ -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;