The patch does not change the function, the existing percent calculation using scale should be about rounding to integer, it seems to be redundant, we can calculate it directly just like "pressure = not_relaimed * 100 / scanned", no rounding issue. It's also better because of saving several arithmetic operations. Signed-off-by: Yue Hu <huyue2@xxxxxxxxxxx> --- mm/vmpressure.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 6063581..aad1fb2 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -111,7 +111,6 @@ static enum vmpressure_levels vmpressure_level(unsigned long pressure) static enum vmpressure_levels vmpressure_calc_level(unsigned long scanned, unsigned long reclaimed) { - unsigned long scale = scanned + reclaimed; unsigned long pressure = 0; /* @@ -123,13 +122,12 @@ static enum vmpressure_levels vmpressure_calc_level(unsigned long scanned, goto out; /* * We calculate the ratio (in percents) of how many pages were - * scanned vs. reclaimed in a given time frame (window). Note that - * time is in VM reclaimer's "ticks", i.e. number of pages + * unsuccessful reclaimed to scanned in a given time frame (window). + * Note that time is in VM reclaimer's "ticks", i.e. number of pages * scanned. This makes it possible to set desired reaction time * and serves as a ratelimit. */ - pressure = scale - (reclaimed * scale / scanned); - pressure = pressure * 100 / scale; + pressure = (scanned - reclaimed) * 100 / scanned; out: pr_debug("%s: %3lu (s: %lu r: %lu)\n", __func__, pressure, -- 1.9.1��.n������g����a����&ޖ)���)��h���&������梷�����Ǟ�m������)������^�����������v���O��zf������