[PATCH] kexec: yield to scheduler when loading kimage segments

Eric W. Biederman ebiederm at xmission.com
Mon Jun 11 17:45:35 PDT 2018


Jarrett Farnitano <jmf at amazon.com> writes:

> Without yielding while loading kimage segments, a large initrd
> will block all other work on the CPU performing the load until
> it is completed. For example loading an initrd of 200MB on a
> low power single core system will lock up the system for a few
> seconds.
>
> To increase system responsiveness to other tasks at that time,
> call cond_resched() in both the crash kernel and normal kernel
> segment loading loops.
>
> Signed-off-by: Jarrett Farnitano <jmf at amazon.com>

Reviewed-by: "Eric W. Biederman" <ebiederm at xmission.com>

> ---
>  kernel/kexec_core.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index 5616755..8ee07d6 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -783,6 +783,8 @@ static int kimage_load_normal_segment(struct kimage *image,
>  		else
>  			buf += mchunk;
>  		mbytes -= mchunk;
> +
> +		cond_resched();
>  	}
>  out:
>  	return result;
> @@ -847,6 +849,8 @@ static int kimage_load_crash_segment(struct kimage *image,
>  		else
>  			buf += mchunk;
>  		mbytes -= mchunk;
> +
> +		cond_resched();
>  	}
>  out:
>  	return result;



More information about the kexec mailing list