Re: [PATCH 1/2] x86/boot/KASLR: Add two functions for 1GB huge pages handling
From: Ingo Molnar
Date: Sun Jun 24 2018 - 03:13:51 EST
* Baoquan He <bhe@xxxxxxxxxx> wrote:
> On 06/21/18 at 05:01pm, Ingo Molnar wrote:
> >
> > * Baoquan He <bhe@xxxxxxxxxx> wrote:
> >
> > > +/* Store the number of 1GB huge pages which user specified.*/
> > > +static unsigned long max_gb_huge_pages;
> > > +
> > > +static int parse_gb_huge_pages(char *param, char* val)
> > > +{
> > > + char *p;
> > > + u64 mem_size;
> > > + static bool gbpage_sz = false;
> > > +
> > > + if (!strcmp(param, "hugepagesz")) {
> > > + p = val;
> > > + mem_size = memparse(p, &p);
> > > + if (mem_size == PUD_SIZE) {
> > > + if (gbpage_sz)
> > > + warn("Repeadly set hugeTLB page size of 1G!\n");
> > > + gbpage_sz = true;
> > > + } else
> > > + gbpage_sz = false;
> > > + } else if (!strcmp(param, "hugepages") && gbpage_sz) {
> > > + p = val;
> > > + max_gb_huge_pages = simple_strtoull(p, &p, 0);
> > > + debug_putaddr(max_gb_huge_pages);
> > > + }
> > > +}
> >
> > This function has at least one style problem and one typo.
> >
> > Also, we don't put statics in the middle of function variable blocks.
> >
>
> Sorry, I will check all of them carefully and repost according to your
> comments.
Thanks!
Ingo