linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hugetlb: release pages in the error path of hugetlb_cow()
@ 2011-11-11 13:01 Hillf Danton
  2011-11-11 17:23 ` Andrea Arcangeli
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hillf Danton @ 2011-11-11 13:01 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andrea Arcangeli, Hugh Dickins, Johannes Weiner, LKML, linux-mm

If fail to prepare anon_vma, {new, old}_page should be released, or they will
escape the track and/or control of memory management.

Thanks

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/mm/hugetlb.c	Fri Nov 11 20:36:32 2011
+++ b/mm/hugetlb.c	Fri Nov 11 20:43:06 2011
@@ -2422,6 +2422,8 @@ retry_avoidcopy:
 	 * anon_vma prepared.
 	 */
 	if (unlikely(anon_vma_prepare(vma))) {
+		page_cache_release(new_page);
+		page_cache_release(old_page);
 		/* Caller expects lock to be held */
 		spin_lock(&mm->page_table_lock);
 		return VM_FAULT_OOM;

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hugetlb: release pages in the error path of hugetlb_cow()
  2011-11-11 13:01 [PATCH] hugetlb: release pages in the error path of hugetlb_cow() Hillf Danton
@ 2011-11-11 17:23 ` Andrea Arcangeli
  2011-11-15 15:38 ` Michal Hocko
  2011-11-21  8:12 ` Johannes Weiner
  2 siblings, 0 replies; 4+ messages in thread
From: Andrea Arcangeli @ 2011-11-11 17:23 UTC (permalink / raw)
  To: Hillf Danton; +Cc: Andrew Morton, Hugh Dickins, Johannes Weiner, LKML, linux-mm

On Fri, Nov 11, 2011 at 09:01:20PM +0800, Hillf Danton wrote:
> If fail to prepare anon_vma, {new, old}_page should be released, or they will
> escape the track and/or control of memory management.
> 
> Thanks
> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---
> 
> --- a/mm/hugetlb.c	Fri Nov 11 20:36:32 2011
> +++ b/mm/hugetlb.c	Fri Nov 11 20:43:06 2011
> @@ -2422,6 +2422,8 @@ retry_avoidcopy:
>  	 * anon_vma prepared.
>  	 */
>  	if (unlikely(anon_vma_prepare(vma))) {
> +		page_cache_release(new_page);
> +		page_cache_release(old_page);
>  		/* Caller expects lock to be held */
>  		spin_lock(&mm->page_table_lock);
>  		return VM_FAULT_OOM;

Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hugetlb: release pages in the error path of hugetlb_cow()
  2011-11-11 13:01 [PATCH] hugetlb: release pages in the error path of hugetlb_cow() Hillf Danton
  2011-11-11 17:23 ` Andrea Arcangeli
@ 2011-11-15 15:38 ` Michal Hocko
  2011-11-21  8:12 ` Johannes Weiner
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2011-11-15 15:38 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Andrew Morton, Andrea Arcangeli, Hugh Dickins, Johannes Weiner,
	LKML, linux-mm

On Fri 11-11-11 21:01:20, Hillf Danton wrote:
> If fail to prepare anon_vma, {new, old}_page should be released, or they will
> escape the track and/or control of memory management.

Looks good (intrduced by in .36 by 0fe6e20b: hugetlb, rmap: add reverse
mapping for hugepage). The failure case is really not probable but I
guess this is still a candidate for stable kernel.

> 
> Thanks
> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>

Reviewed-by: Michal Hocko <mhocko@suse.cz>

> ---
> 
> --- a/mm/hugetlb.c	Fri Nov 11 20:36:32 2011
> +++ b/mm/hugetlb.c	Fri Nov 11 20:43:06 2011
> @@ -2422,6 +2422,8 @@ retry_avoidcopy:
>  	 * anon_vma prepared.
>  	 */
>  	if (unlikely(anon_vma_prepare(vma))) {
> +		page_cache_release(new_page);
> +		page_cache_release(old_page);
>  		/* Caller expects lock to be held */
>  		spin_lock(&mm->page_table_lock);
>  		return VM_FAULT_OOM;
> 
> --
> 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/ .
> Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hugetlb: release pages in the error path of hugetlb_cow()
  2011-11-11 13:01 [PATCH] hugetlb: release pages in the error path of hugetlb_cow() Hillf Danton
  2011-11-11 17:23 ` Andrea Arcangeli
  2011-11-15 15:38 ` Michal Hocko
@ 2011-11-21  8:12 ` Johannes Weiner
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Weiner @ 2011-11-21  8:12 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Andrew Morton, Andrea Arcangeli, Hugh Dickins, LKML, linux-mm

On Fri, Nov 11, 2011 at 09:01:20PM +0800, Hillf Danton wrote:
> If fail to prepare anon_vma, {new, old}_page should be released, or they will
> escape the track and/or control of memory management.
> 
> Thanks
> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>

Acked-by: Johannes Weiner <jweiner@redhat.com>

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-21  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-11 13:01 [PATCH] hugetlb: release pages in the error path of hugetlb_cow() Hillf Danton
2011-11-11 17:23 ` Andrea Arcangeli
2011-11-15 15:38 ` Michal Hocko
2011-11-21  8:12 ` Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).