]> git.baikalelectronics.ru Git - kernel.git/commit
mm/page-writeback: fix dirty_ratelimit calculation
authorAndrey Ryabinin <aryabinin@virtuozzo.com>
Tue, 15 Mar 2016 21:55:27 +0000 (14:55 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 15 Mar 2016 23:55:16 +0000 (16:55 -0700)
commit81e4df9e3cb1d2b06f9f5e32644e4a9e82548f51
treec0d59e0a254d7c4b9f31ee3a4873423cc200ee35
parent440191f67dc2beee2bb26a4b91aa7970bde0e7c0
mm/page-writeback: fix dirty_ratelimit calculation

Calculation of dirty_ratelimit sometimes is not correct.  E.g.  initial
values of dirty_ratelimit == INIT_BW and step == 0, lead to the
following result:

   UBSAN: Undefined behaviour in ../mm/page-writeback.c:1286:7
   shift exponent 25600 is too large for 64-bit type 'long unsigned int'

The fix is straightforward - make step 0 if the shift exponent is too
big.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page-writeback.c