Re: [PATCH v2] vmpressure: wake up work only when there is registration event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 14-09-21 09:05:51, yongw.pur@xxxxxxxxx wrote:
> From: wangyong <wang.yong12@xxxxxxxxxx>
> 
> Use the global variable num_events to record the number of vmpressure
> events registered by the system, and wake up work only when there is
> registration event.
> Usually, the vmpressure event is not registered in the system, this patch
> can avoid waking up work and doing nothing.

I have asked in the previous version and this changelog doesn't that
explain again. Why don't you simply bail out early in vmpressure()
entry?

> Test with 5.14.0-rc5-next-20210813 on x86_64 4G ram.
> Consume cgroup memory until it is about to be reclaimed, then execute
> "perf stat -I 2000 malloc.out" command to trigger memory reclamation
> and get performance results.
> The context-switches is reduced by about 20 times.

Is this test somewhere available so that it can be reproduced by
others. Also while the number of context switches can be an interesting
it is not really clear from this evaluation whether that actually
matters or not. E.g. what does an increase of task-clock and twice as
many instructions recorded tell us?

> unpatched:
> Average of 10 test results
> 582.4674048	task-clock(msec)
> 19910.8		context-switches
> 0		cpu-migrations
> 1292.9		page-faults
> 414784733.1	cycles

> <not supported>	stalled-cycles-frontend
> <not supported>	stalled-cycles-backend

Why is this a part of the data?

> 580070698.4	instructions
> 125572244.7	branches
> 2073541.2	branch-misses
> 
> patched
> Average of 10 test results
> 973.6174796	task-clock(msec)
> 988.6		context-switches
> 0		cpu-migrations
> 1785.2		page-faults
> 772883602.4	cycles
> <not supported>	stalled-cycles-frontend
> <not supported>	stalled-cycles-backend
> 1360280911	instructions
> 290519434.9	branches
> 3378378.2	branch-misses
> 
> Tested-by: Zeal Robot <zealci@xxxxxxxxxx>
> Signed-off-by: wangyong <wang.yong12@xxxxxxxxxx>
> ---
> 
[...]
> @@ -272,6 +277,9 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
>  		return;
>  
>  	if (tree) {
> +		if (!static_branch_unlikely(&num_events))
> +			return;

We usually hide the change behind a static inline helper (e.g.
vmpressure_disabled()). I would also put it to the beginning of
vmpressure or put an explanation why it makes sense only in this branch.
-- 
Michal Hocko
SUSE Labs




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux