From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx149.postini.com [74.125.245.149]) by kanga.kvack.org (Postfix) with SMTP id D17876B005A for ; Wed, 21 Aug 2013 06:49:28 -0400 (EDT) Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Aug 2013 16:11:44 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 1ADC61258055 for ; Wed, 21 Aug 2013 16:19:09 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7LAoukw35127498 for ; Wed, 21 Aug 2013 16:20:56 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7LAnLHB005505 for ; Wed, 21 Aug 2013 16:19:22 +0530 From: "Aneesh Kumar K.V" Subject: Re: [PATCH v2 10/20] mm, hugetlb: remove resv_map_put() In-Reply-To: <1376040398-11212-11-git-send-email-iamjoonsoo.kim@lge.com> References: <1376040398-11212-1-git-send-email-iamjoonsoo.kim@lge.com> <1376040398-11212-11-git-send-email-iamjoonsoo.kim@lge.com> Date: Wed, 21 Aug 2013 16:19:20 +0530 Message-ID: <8761uzgvyn.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain Sender: owner-linux-mm@kvack.org List-ID: To: Joonsoo Kim , Andrew Morton Cc: Rik van Riel , Mel Gorman , Michal Hocko , KAMEZAWA Hiroyuki , Hugh Dickins , Davidlohr Bueso , David Gibson , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim , Wanpeng Li , Naoya Horiguchi , Hillf Danton Joonsoo Kim writes: > In following patch, I change vma_resv_map() to return resv_map > for all case. This patch prepares it by removing resv_map_put() which > doesn't works properly with following change, because it works only for > HPAGE_RESV_OWNER's resv_map, not for all resv_maps. > > Signed-off-by: Joonsoo Kim > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 73034dd..869c3e0 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -2212,15 +2212,6 @@ static void hugetlb_vm_op_open(struct vm_area_struct *vma) > kref_get(&resv->refs); > } > > -static void resv_map_put(struct vm_area_struct *vma) > -{ > - struct resv_map *resv = vma_resv_map(vma); > - > - if (!resv) > - return; > - kref_put(&resv->refs, resv_map_release); > -} Why not have seperate functions to return vma_resv_map for HPAGE_RESV_OWNER and one for put ? That way we could have something like resv_map_hpage_resv_owner_get() resv_map_hpge_resv_put() Reviewed-by: Aneesh Kumar K.V > - > static void hugetlb_vm_op_close(struct vm_area_struct *vma) > { > struct hstate *h = hstate_vma(vma); > @@ -2237,7 +2228,7 @@ static void hugetlb_vm_op_close(struct vm_area_struct *vma) > reserve = (end - start) - > region_count(resv, start, end); > > - resv_map_put(vma); > + kref_put(&resv->refs, resv_map_release); > > if (reserve) { > hugetlb_acct_memory(h, -reserve); > @@ -3164,8 +3155,8 @@ int hugetlb_reserve_pages(struct inode *inode, > region_add(resv_map, from, to); > return 0; > out_err: > - if (vma) > - resv_map_put(vma); > + if (vma && is_vma_resv_set(vma, HPAGE_RESV_OWNER)) > + kref_put(&resv_map->refs, resv_map_release); for this if (alloc) resv_map_hpage_resv_put(); > return ret; > } > > -- > 1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org