Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752379AbbGaIhy (ORCPT ); Fri, 31 Jul 2015 04:37:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33994 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751364AbbGaIhw (ORCPT ); Fri, 31 Jul 2015 04:37:52 -0400 Date: Fri, 31 Jul 2015 16:37:49 +0800 From: Baoquan He To: Minfei Huang Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org, tatsu@ab.jp.nec.com, lisa.mitchell@hp.com, seiji.aguchi.tr@hitachi.com, dyoung@redhat.com, vgoyal@redhat.com, ebiederm@xmission.com Subject: Re: [PATCH] align crash_notes allocation to make it be inside one physical page Message-ID: <20150731083749.GB13148@dhcp-128-28.nay.redhat.com> References: <1438225679-13052-1-git-send-email-bhe@redhat.com> <20150730051553.GB27915@dhcp-128-25.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150730051553.GB27915@dhcp-128-25.nay.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1310 Lines: 37 On 07/30/15 at 01:15pm, Minfei Huang wrote: > On 07/30/15 at 11:07am, Baoquan He wrote: > > diff --git a/kernel/kexec.c b/kernel/kexec.c > > index a785c10..1740c42 100644 > > --- a/kernel/kexec.c > > +++ b/kernel/kexec.c > > @@ -1620,7 +1620,16 @@ void crash_save_cpu(struct pt_regs *regs, int cpu) > > static int __init crash_notes_memory_init(void) > > { > > /* Allocate memory for saving cpu registers. */ > > - crash_notes = alloc_percpu(note_buf_t); > > + size_t size, align; > > + int order; > > + > > + size = sizeof(note_buf_t); > > + order = get_count_order(size); > > + align = 1<< order; > > + > > + WARN_ON(size > PAGE_SIZE); > > It is fine without this warning, since percpu will fail to allocate the > memory larger than PAGE_SIZE. Thanks for your comment. percpu will fail if align is larger than PAGE_SIZE. I will adjust it as align = min(1<