Commit 13064781 authored by Hui Su's avatar Hui Su Committed by Linus Torvalds

mm/page_counter: use page_counter_read in page_counter_set_max

Use page_counter_read() in page_counter_set_max().

Link: https://lkml.kernel.org/r/20201113141048.GA178922@rlkSigned-off-by: default avatarHui Su <sh_def@163.com>
Reviewed-by: default avatarPankaj Gupta <pankaj.gupta@cloud.ionos.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9d9d341d
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment