Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753510AbcLIF57 (ORCPT ); Fri, 9 Dec 2016 00:57:59 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:13705 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750744AbcLIF56 (ORCPT ); Fri, 9 Dec 2016 00:57:58 -0500 Message-ID: <584A47A2.1040001@huawei.com> Date: Fri, 9 Dec 2016 13:56:50 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: "Eric W. Biederman" CC: , Xunlei Pang , , , Subject: Re: [PATCH v2] kexec: add cond_resched into kimage_alloc_crash_control_pages References: <1481164674-42775-1-git-send-email-zhongjiang@huawei.com> <58492ADC.4070305@redhat.com> <584A3D84.6040004@huawei.com> <87inqtn0gm.fsf@xmission.com> In-Reply-To: <87inqtn0gm.fsf@xmission.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1509 Lines: 40 On 2016/12/9 13:19, Eric W. Biederman wrote: > zhong jiang writes: > >> On 2016/12/8 17:41, Xunlei Pang wrote: >>> On 12/08/2016 at 10:37 AM, zhongjiang wrote: >>>> From: zhong jiang >>>> > [snip] >>>> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c >>>> index 5616755..bfc9621 100644 >>>> --- a/kernel/kexec_core.c >>>> +++ b/kernel/kexec_core.c >>>> @@ -441,6 +441,8 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image, >>>> while (hole_end <= crashk_res.end) { >>>> unsigned long i; >>>> >>>> + cond_resched(); >>>> + >>> I can't see why it would take a long time to loop inside, the job it does is simply to find a control area >>> not overlapped with image->segment[], you can see the loop "for (i = 0; i < image->nr_segments; i++)", >>> @hole_end will be advanced to the end of its next nearby segment once overlap was detected each loop, >>> also there are limited (<=16) segments, so it won't take long to locate the right area. >>> >>> Am I missing something? >>> >>> Regards, >>> Xunlei >> if the crashkernel = auto is set in cmdline. it represent crashk_res.end will exceed to 4G, the first allocate control pages will >> loop million times. if we set crashk_res.end to the higher value >> manually, you can image.... > Or in short the cond_resched is about keeping things reasonable when the > loop has worst case behavior. > > Eric > > Yes, Thank you reply and comment. Regards, zhongjiang