Re: [patch] mm, hugetlb: generalize writes to nr_hugepages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 8 Jul 2014 15:11:13 -0700
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Wed, 2 Jul 2014 17:44:46 -0700 (PDT) David Rientjes <rientjes@xxxxxxxxxx> wrote:
> 
> > > > @@ -2248,36 +2257,18 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
> > > >  			 void __user *buffer, size_t *length, loff_t *ppos)
> > > >  {
> > > >  	struct hstate *h = &default_hstate;
> > > > -	unsigned long tmp;
> > > > +	unsigned long tmp = h->max_huge_pages;
> > > >  	int ret;
> > > >  
> > > > -	if (!hugepages_supported())
> > > > -		return -ENOTSUPP;
> > > 
> > > Shouldn't you add this check to __nr_hugepages_store_common()? Otherwise
> > > looks good to me.
> > > 
> > 
> > Hmm, I think you're right but I don't think __nr_hugepages_store_common() 
> > is the right place: if we have a legitimate hstate for the sysfs tunables 
> > then we should support hugepages.  I think this should be kept in 
> > hugetlb_sysctl_handler_common().
> 
> This?

Yes.

> 
> --- a/mm/hugetlb.c~mm-hugetlb-generalize-writes-to-nr_hugepages-fix
> +++ a/mm/hugetlb.c
> @@ -2260,6 +2260,9 @@ static int hugetlb_sysctl_handler_common
>  	unsigned long tmp = h->max_huge_pages;
>  	int ret;
>  
> +	if (!hugepages_supported())
> +		return -ENOTSUPP;
> +
>  	table->data = &tmp;
>  	table->maxlen = sizeof(unsigned long);
>  	ret = proc_doulongvec_minmax(table, write, buffer, length, ppos);
> _
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]