Re: [PATCH -mm 1/2] kexec/i386: kexec page table code clean up -add arch_kimage
From: Huang, Ying
Date: Wed Jan 09 2008 - 21:06:41 EST
On Wed, 2008-01-09 at 20:14 -0500, Vivek Goyal wrote:
[...]
> >
> > +static void alloc_page_tables(struct kimage *image)
> > +{
>
> This is too generic a name. How about something like
> arch_alloc_kexec_page_tables()
OK, I will change it.
> > + image->arch_kimage.pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL);
> > +#ifdef CONFIG_X86_PAE
> > + image->arch_kimage.pmd0 = (pmd_t *)get_zeroed_page(GFP_KERNEL);
> > + image->arch_kimage.pmd1 = (pmd_t *)get_zeroed_page(GFP_KERNEL);
> > +#endif
> > + image->arch_kimage.pte0 = (pte_t *)get_zeroed_page(GFP_KERNEL);
> > + image->arch_kimage.pte1 = (pte_t *)get_zeroed_page(GFP_KERNEL);
> > +}
> > +
> > +static void free_page_tables(struct kimage *image)
> > +{
>
> How about arch_free_kexec_page_tables()
OK, I will change it.
> > + free_page((unsigned long)image->arch_kimage.pgd);
> > +#ifdef CONFIG_X86_PAE
> > + free_page((unsigned long)image->arch_kimage.pmd0);
> > + free_page((unsigned long)image->arch_kimage.pmd1);
> > +#endif
> > + free_page((unsigned long)image->arch_kimage.pte0);
> > + free_page((unsigned long)image->arch_kimage.pte1);
> > +}
> > +
> > /*
> > * A architecture hook called to validate the
> > * proposed image and prepare the control pages
> > @@ -83,10 +97,21 @@ static void load_segments(void)
> > * reboot code buffer to allow us to avoid allocations
> > * later.
> > *
> > - * Currently nothing.
> > + * - Allocate page tables
> > */
> > int machine_kexec_prepare(struct kimage *image)
> > {
> > + alloc_page_tables(image);
> > + if (!image->arch_kimage.pgd ||
> > +#ifdef CONFIG_X86_PAE
> > + !image->arch_kimage.pmd0 ||
> > + !image->arch_kimage.pmd1 ||
> > +#endif
> > + !image->arch_kimage.pte0 ||
> > + !image->arch_kimage.pte1) {
> > + free_page_tables(image);
> > + return -ENOMEM;
>
> I think this error handling can be done in alloc_page_tables() itself and
> following will look neater.
OK, I will change it.
Best Regards,
Huang Ying
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/