From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933095AbcLIFWn (ORCPT ); Fri, 9 Dec 2016 00:22:43 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:44921 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932460AbcLIFWm (ORCPT ); Fri, 9 Dec 2016 00:22:42 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: zhong jiang Cc: , Xunlei Pang , , , References: <1481164674-42775-1-git-send-email-zhongjiang@huawei.com> <58492ADC.4070305@redhat.com> <584A3D84.6040004@huawei.com> Date: Fri, 09 Dec 2016 18:19:37 +1300 In-Reply-To: <584A3D84.6040004@huawei.com> (zhong jiang's message of "Fri, 9 Dec 2016 13:13:40 +0800") Message-ID: <87inqtn0gm.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1cFDdi-0007n1-FS;;;mid=<87inqtn0gm.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=101.100.131.98;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/5EhnrlW2otABBI91Jd3fiz3baSzFtEjE= X-SA-Exim-Connect-IP: 101.100.131.98 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.0 XMGappySubj_02 Gappier still * 0.5 XMGappySubj_01 Very gappy subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 BAYES_40 BODY: Bayes spam probability is 20 to 40% * [score: 0.2729] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;zhong jiang X-Spam-Relay-Country: X-Spam-Timing: total 5542 ms - load_scoreonly_sql: 0.07 (0.0%), signal_user_changed: 3.9 (0.1%), b_tie_ro: 2.7 (0.0%), parse: 1.11 (0.0%), extract_message_metadata: 13 (0.2%), get_uri_detail_list: 1.52 (0.0%), tests_pri_-1000: 6 (0.1%), tests_pri_-950: 1.19 (0.0%), tests_pri_-900: 1.02 (0.0%), tests_pri_-400: 18 (0.3%), check_bayes: 17 (0.3%), b_tokenize: 5 (0.1%), b_tok_get_all: 5 (0.1%), b_comp_prob: 1.67 (0.0%), b_tok_touch_all: 2.8 (0.0%), b_finish: 0.69 (0.0%), tests_pri_0: 258 (4.6%), check_dkim_signature: 0.73 (0.0%), check_dkim_adsp: 4.0 (0.1%), tests_pri_500: 5237 (94.5%), poll_dns_idle: 5232 (94.4%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v2] kexec: add cond_resched into kimage_alloc_crash_control_pages X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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