Skip to content
Snippets Groups Projects
Commit 3bafc47d authored by SeongJae Park's avatar SeongJae Park Committed by Andrew Morton
Browse files

mm/damon/ops-common: avoid divide-by-zero during region hotness calculation

When calculating the hotness of each region for the under-quota regions
prioritization, DAMON divides some values by the maximum nr_accesses. 
However, due to the type of the related variables, simple division-based
calculation of the divisor can return zero.  As a result, divide-by-zero
is possible.  Fix it by using damon_max_nr_accesses(), which handles the
case.

Link: https://lkml.kernel.org/r/20231019194924.100347-4-sj@kernel.org


Fixes: 198f0f4c ("mm/damon/vaddr,paddr: support pageout prioritization")
Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
Reported-by: default avatarJakub Acs <acsjakub@amazon.de>
Cc: <stable@vger.kernel.org>	[5.16+]
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent d35963bf
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment