X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=mm%2Fpage_counter.c;h=afe22ad335ccc2a0be5a3ee3514d97e46ee1bddd;hb=ba9086a6df1ea8bb2bbed7a92f14bfddc10fb8a7;hp=b4663844c9b3740d2c26c4298e882d00b5ec998f;hpb=87bd8c2b93ae899ecd90a5e0550cdae4260cc4ca;p=linux-2.6-microblaze.git diff --git a/mm/page_counter.c b/mm/page_counter.c index b4663844c9b3..afe22ad335cc 100644 --- a/mm/page_counter.c +++ b/mm/page_counter.c @@ -77,8 +77,8 @@ void page_counter_charge(struct page_counter *counter, unsigned long nr_pages) * This is indeed racy, but we can live with some * inaccuracy in the watermark. */ - if (new > c->watermark) - c->watermark = new; + if (new > READ_ONCE(c->watermark)) + WRITE_ONCE(c->watermark, new); } } @@ -119,9 +119,10 @@ bool page_counter_try_charge(struct page_counter *counter, propagate_protected_usage(c, new); /* * This is racy, but we can live with some - * inaccuracy in the failcnt. + * inaccuracy in the failcnt which is only used + * to report stats. */ - c->failcnt++; + data_race(c->failcnt++); *fail = c; goto failed; } @@ -130,8 +131,8 @@ bool page_counter_try_charge(struct page_counter *counter, * Just like with failcnt, we can live with some * inaccuracy in the watermark. */ - if (new > c->watermark) - c->watermark = new; + if (new > READ_ONCE(c->watermark)) + WRITE_ONCE(c->watermark, new); } return true;