linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: hugetlb: add might_sleep() for gigantic page
@ 2011-12-23 13:41 Hillf Danton
  2011-12-26  7:32 ` KAMEZAWA Hiroyuki
  2011-12-27 12:59 ` Michal Hocko
  0 siblings, 2 replies; 7+ messages in thread
From: Hillf Danton @ 2011-12-23 13:41 UTC (permalink / raw)
  To: linux-mm; +Cc: LKML, Andrew Morton, Michal Hocko, KAMEZAWA Hiroyuki

From: Hillf Danton <dhillf@gmail.com>
Subject: [PATCH] mm: hugetlb: add might_sleep() for gigantic page

Like the case of huge page, might_sleep() is added for gigantic page, then
both are treated in same way.

Cc: Michal Hocko <mhocko@suse.cz>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/mm/hugetlb.c	Tue Dec 20 21:26:30 2011
+++ b/mm/hugetlb.c	Fri Dec 23 21:19:18 2011
@@ -401,6 +401,7 @@ static void copy_gigantic_page(struct pa
 	struct page *dst_base = dst;
 	struct page *src_base = src;

+	might_sleep();
 	for (i = 0; i < pages_per_huge_page(h); ) {
 		cond_resched();
 		copy_highpage(dst, src);

--
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] 7+ messages in thread

* Re: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
  2011-12-23 13:41 [PATCH] mm: hugetlb: add might_sleep() for gigantic page Hillf Danton
@ 2011-12-26  7:32 ` KAMEZAWA Hiroyuki
  2011-12-27 12:59 ` Michal Hocko
  1 sibling, 0 replies; 7+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-12-26  7:32 UTC (permalink / raw)
  To: Hillf Danton; +Cc: linux-mm, LKML, Andrew Morton, Michal Hocko

On Fri, 23 Dec 2011 21:41:08 +0800
Hillf Danton <dhillf@gmail.com> wrote:

> From: Hillf Danton <dhillf@gmail.com>
> Subject: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
> 
> Like the case of huge page, might_sleep() is added for gigantic page, then
> both are treated in same way.
> 
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Hillf Danton <dhillf@gmail.com>

Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.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] 7+ messages in thread

* Re: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
  2011-12-23 13:41 [PATCH] mm: hugetlb: add might_sleep() for gigantic page Hillf Danton
  2011-12-26  7:32 ` KAMEZAWA Hiroyuki
@ 2011-12-27 12:59 ` Michal Hocko
  2011-12-27 13:21   ` Hillf Danton
  1 sibling, 1 reply; 7+ messages in thread
From: Michal Hocko @ 2011-12-27 12:59 UTC (permalink / raw)
  To: Hillf Danton; +Cc: linux-mm, LKML, Andrew Morton, KAMEZAWA Hiroyuki

On Fri 23-12-11 21:41:08, Hillf Danton wrote:
> From: Hillf Danton <dhillf@gmail.com>
> Subject: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
> 
> Like the case of huge page, might_sleep() is added for gigantic page, then
> both are treated in same way.

Why do we need to call might_sleep here? There is cond_resched in the
loop...

> 
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---
> 
> --- a/mm/hugetlb.c	Tue Dec 20 21:26:30 2011
> +++ b/mm/hugetlb.c	Fri Dec 23 21:19:18 2011
> @@ -401,6 +401,7 @@ static void copy_gigantic_page(struct pa
>  	struct page *dst_base = dst;
>  	struct page *src_base = src;
> 
> +	might_sleep();
>  	for (i = 0; i < pages_per_huge_page(h); ) {
>  		cond_resched();
>  		copy_highpage(dst, src);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
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] 7+ messages in thread

* Re: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
  2011-12-27 12:59 ` Michal Hocko
@ 2011-12-27 13:21   ` Hillf Danton
  2011-12-27 13:30     ` Michal Hocko
  0 siblings, 1 reply; 7+ messages in thread
From: Hillf Danton @ 2011-12-27 13:21 UTC (permalink / raw)
  To: Michal Hocko; +Cc: linux-mm, LKML, Andrew Morton, KAMEZAWA Hiroyuki

On Tue, Dec 27, 2011 at 8:59 PM, Michal Hocko <mhocko@suse.cz> wrote:
> On Fri 23-12-11 21:41:08, Hillf Danton wrote:
>> From: Hillf Danton <dhillf@gmail.com>
>> Subject: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
>>
>> Like the case of huge page, might_sleep() is added for gigantic page, then
>> both are treated in same way.
>
> Why do we need to call might_sleep here? There is cond_resched in the
> loop...
>

IIUC it is the reason to add... and the comment says

/**
 * might_sleep - annotation for functions that can sleep
 *
 * this macro will print a stack trace if it is executed in an atomic
 * context (spinlock, irq-handler, ...).
 *
 * This is a useful debugging help to be able to catch problems early and not
 * be bitten later when the calling function happens to sleep when it is not
 * supposed to.
 */

Thanks
Hillf

--
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] 7+ messages in thread

* Re: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
  2011-12-27 13:21   ` Hillf Danton
@ 2011-12-27 13:30     ` Michal Hocko
  2011-12-27 13:38       ` Hillf Danton
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Hocko @ 2011-12-27 13:30 UTC (permalink / raw)
  To: Hillf Danton; +Cc: linux-mm, LKML, Andrew Morton, KAMEZAWA Hiroyuki

On Tue 27-12-11 21:21:18, Hillf Danton wrote:
> On Tue, Dec 27, 2011 at 8:59 PM, Michal Hocko <mhocko@suse.cz> wrote:
> > On Fri 23-12-11 21:41:08, Hillf Danton wrote:
> >> From: Hillf Danton <dhillf@gmail.com>
> >> Subject: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
> >>
> >> Like the case of huge page, might_sleep() is added for gigantic page, then
> >> both are treated in same way.
> >
> > Why do we need to call might_sleep here? There is cond_resched in the
> > loop...
> >
> 
> IIUC it is the reason to add... and the comment says

cond_resched calls __might_sleep so there is no reason to call
might_sleep outside the loop as well.

-- 
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] 7+ messages in thread

* Re: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
  2011-12-27 13:30     ` Michal Hocko
@ 2011-12-27 13:38       ` Hillf Danton
  2011-12-27 13:39         ` Michal Hocko
  0 siblings, 1 reply; 7+ messages in thread
From: Hillf Danton @ 2011-12-27 13:38 UTC (permalink / raw)
  To: Michal Hocko; +Cc: linux-mm, LKML, Andrew Morton, KAMEZAWA Hiroyuki

On Tue, Dec 27, 2011 at 9:30 PM, Michal Hocko <mhocko@suse.cz> wrote:
> On Tue 27-12-11 21:21:18, Hillf Danton wrote:
>> On Tue, Dec 27, 2011 at 8:59 PM, Michal Hocko <mhocko@suse.cz> wrote:
>> > On Fri 23-12-11 21:41:08, Hillf Danton wrote:
>> >> From: Hillf Danton <dhillf@gmail.com>
>> >> Subject: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
>> >>
>> >> Like the case of huge page, might_sleep() is added for gigantic page, then
>> >> both are treated in same way.
>> >
>> > Why do we need to call might_sleep here? There is cond_resched in the
>> > loop...
>> >
>>
>> IIUC it is the reason to add... and the comment says
>
> cond_resched calls __might_sleep so there is no reason to call
> might_sleep outside the loop as well.
>
Yes, thanks. And remove it in the huge page case?

Hillf

--
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] 7+ messages in thread

* Re: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
  2011-12-27 13:38       ` Hillf Danton
@ 2011-12-27 13:39         ` Michal Hocko
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Hocko @ 2011-12-27 13:39 UTC (permalink / raw)
  To: Hillf Danton; +Cc: linux-mm, LKML, Andrew Morton, KAMEZAWA Hiroyuki

On Tue 27-12-11 21:38:59, Hillf Danton wrote:
> On Tue, Dec 27, 2011 at 9:30 PM, Michal Hocko <mhocko@suse.cz> wrote:
> > On Tue 27-12-11 21:21:18, Hillf Danton wrote:
> >> On Tue, Dec 27, 2011 at 8:59 PM, Michal Hocko <mhocko@suse.cz> wrote:
> >> > On Fri 23-12-11 21:41:08, Hillf Danton wrote:
> >> >> From: Hillf Danton <dhillf@gmail.com>
> >> >> Subject: [PATCH] mm: hugetlb: add might_sleep() for gigantic page
> >> >>
> >> >> Like the case of huge page, might_sleep() is added for gigantic page, then
> >> >> both are treated in same way.
> >> >
> >> > Why do we need to call might_sleep here? There is cond_resched in the
> >> > loop...
> >> >
> >>
> >> IIUC it is the reason to add... and the comment says
> >
> > cond_resched calls __might_sleep so there is no reason to call
> > might_sleep outside the loop as well.
> >
> Yes, thanks. And remove it in the huge page case?

Yes, makes sense.

-- 
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] 7+ messages in thread

end of thread, other threads:[~2011-12-27 13:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-23 13:41 [PATCH] mm: hugetlb: add might_sleep() for gigantic page Hillf Danton
2011-12-26  7:32 ` KAMEZAWA Hiroyuki
2011-12-27 12:59 ` Michal Hocko
2011-12-27 13:21   ` Hillf Danton
2011-12-27 13:30     ` Michal Hocko
2011-12-27 13:38       ` Hillf Danton
2011-12-27 13:39         ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox