Re: [PATCH v2 09/20] mm, hugetlb: protect region tracking via newly introduced resv_map lock

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

 



On Wed, Aug 21, 2013 at 03:43:27PM +0530, Aneesh Kumar K.V wrote:

> >  static long region_chg(struct resv_map *resv, long f, long t)
> >  {
> >  	struct list_head *head = &resv->regions;
> > -	struct file_region *rg, *nrg;
> > +	struct file_region *rg, *nrg = NULL;
> >  	long chg = 0;
> >
> > +retry:
> > +	spin_lock(&resv->lock);
> >  	/* Locate the region we are before or in. */
> >  	list_for_each_entry(rg, head, link)
> >  		if (f <= rg->to)
> > @@ -202,15 +199,27 @@ static long region_chg(struct resv_map *resv, long f, long t)
> >  	 * Subtle, allocate a new region at the position but make it zero
> >  	 * size such that we can guarantee to record the reservation. */
> >  	if (&rg->link == head || t < rg->from) {
> > -		nrg = kmalloc(sizeof(*nrg), GFP_KERNEL);
> > -		if (!nrg)
> > -			return -ENOMEM;
> > +		if (!nrg) {
> > +			nrg = kmalloc(sizeof(*nrg), GFP_NOWAIT);
> 
> Do we really need to have the GFP_NOWAIT allocation attempt. Why can't we simply say
> allocate and retry ? Or should resv->lock be a mutex ?
> 

Yes, your proposal that simply allocate and retry looks good to me.
I will change it.

Thanks.

--
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]