[LTP] [PATCH 2/4] memcg_process_stress: allocate memory not in the signal handler

Cyril Hrubis chrubis@suse.cz
Thu May 12 13:26:45 CEST 2016


Hi!
> >>   	while (!flag_exit) {
> >>   		sleep(interval);
> >>
> >> -		if (flag_ready)
> >> +		if (flag_ready) {
> >> +			if (!allocated) {
> >> +				alloc_memory();
> >> +				allocated = 1;
> >> +			}
> >> +
> >>   			touch_memory();
> >> +		}
> >>   	}
> >
> >
> > We can do even better if we change the sleep() for pause().
> 
> Thank you for the review. I agree with all other comments to this 
> series, except this one.
> 
> I'd keep sleep() here, because it allows the process to perform a series 
> of touch_memory() invocations before it receives the final SIGINT signal.

You are right, I've missed that yesterday.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list