All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] make refrigerator cold
@ 2009-09-22  4:04 Stephen Hemminger
  2009-09-22 19:54 ` Rafael J. Wysocki
  2009-09-22 19:54 ` Rafael J. Wysocki
  0 siblings, 2 replies; 9+ messages in thread
From: Stephen Hemminger @ 2009-09-22  4:04 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, Andrew Morton, linux-kernel, linux-pm

By marking it cold, then the code path in kernel thread 
usage of try_to_freeze() that is normally used be
selected.

Don't think it matters that much for performance but the
concordance of this patch struck me as humorous.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/include/linux/freezer.h	2009-09-21 20:34:17.579233461 -0700
+++ b/include/linux/freezer.h	2009-09-21 20:35:25.724322028 -0700
@@ -47,7 +47,7 @@ static inline bool should_send_signal(st
 /* Takes and releases task alloc lock using task_lock() */
 extern int thaw_process(struct task_struct *p);
 
-extern void refrigerator(void);
+extern void refrigerator(void) __cold;
 extern int freeze_processes(void);
 extern void thaw_processes(void);
 

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

* Re: [PATCH] make refrigerator cold
  2009-09-22  4:04 [PATCH] make refrigerator cold Stephen Hemminger
  2009-09-22 19:54 ` Rafael J. Wysocki
@ 2009-09-22 19:54 ` Rafael J. Wysocki
  2009-09-22 21:09   ` Stephen Hemminger
  2009-09-22 21:09   ` Stephen Hemminger
  1 sibling, 2 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2009-09-22 19:54 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Len Brown, Matt Helsley, Andrew Morton, linux-pm, linux-kernel

On Tuesday 22 September 2009, Stephen Hemminger wrote:
> By marking it cold, then the code path in kernel thread 
> usage of try_to_freeze() that is normally used be
> selected.

The sentence above isn't very clear IMO, could you please rephrase?

> Don't think it matters that much for performance but the
> concordance of this patch struck me as humorous.

Well, yeah.

> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> 
> --- a/include/linux/freezer.h	2009-09-21 20:34:17.579233461 -0700
> +++ b/include/linux/freezer.h	2009-09-21 20:35:25.724322028 -0700
> @@ -47,7 +47,7 @@ static inline bool should_send_signal(st
>  /* Takes and releases task alloc lock using task_lock() */
>  extern int thaw_process(struct task_struct *p);
>  
> -extern void refrigerator(void);
> +extern void refrigerator(void) __cold;
>  extern int freeze_processes(void);
>  extern void thaw_processes(void);

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

* Re: [PATCH] make refrigerator cold
  2009-09-22  4:04 [PATCH] make refrigerator cold Stephen Hemminger
@ 2009-09-22 19:54 ` Rafael J. Wysocki
  2009-09-22 19:54 ` Rafael J. Wysocki
  1 sibling, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2009-09-22 19:54 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Len Brown, Andrew Morton, linux-kernel, linux-pm

On Tuesday 22 September 2009, Stephen Hemminger wrote:
> By marking it cold, then the code path in kernel thread 
> usage of try_to_freeze() that is normally used be
> selected.

The sentence above isn't very clear IMO, could you please rephrase?

> Don't think it matters that much for performance but the
> concordance of this patch struck me as humorous.

Well, yeah.

> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> 
> --- a/include/linux/freezer.h	2009-09-21 20:34:17.579233461 -0700
> +++ b/include/linux/freezer.h	2009-09-21 20:35:25.724322028 -0700
> @@ -47,7 +47,7 @@ static inline bool should_send_signal(st
>  /* Takes and releases task alloc lock using task_lock() */
>  extern int thaw_process(struct task_struct *p);
>  
> -extern void refrigerator(void);
> +extern void refrigerator(void) __cold;
>  extern int freeze_processes(void);
>  extern void thaw_processes(void);

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

* Re: [PATCH] make refrigerator cold
  2009-09-22 19:54 ` Rafael J. Wysocki
  2009-09-22 21:09   ` Stephen Hemminger
@ 2009-09-22 21:09   ` Stephen Hemminger
  2009-09-22 23:13     ` Rafael J. Wysocki
  2009-09-22 23:13     ` Rafael J. Wysocki
  1 sibling, 2 replies; 9+ messages in thread
From: Stephen Hemminger @ 2009-09-22 21:09 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, Matt Helsley, Andrew Morton, linux-pm, linux-kernel

On Tue, 22 Sep 2009 21:54:09 +0200
"Rafael J. Wysocki" <rjw@sisk.pl> wrote:

> On Tuesday 22 September 2009, Stephen Hemminger wrote:
> > By marking it cold, then the code path in kernel thread 
> > usage of try_to_freeze() that is normally used be
> > selected.
> 

In the code for try_to_freeze(), for optimization, it might
help to tell the compiler to not favor the code path where
the refigrator is being called.

Another way to do the same thing would be to do.
   if (unlikely(freezing(current))) {
	refrigerator();
	return 1;
   } else
	return 0;

or build unlikely into the freezing function (see need_resched).

I saw this by trying to minimize the number of intstructions
in pktgen which is a special case.




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

* Re: [PATCH] make refrigerator cold
  2009-09-22 19:54 ` Rafael J. Wysocki
@ 2009-09-22 21:09   ` Stephen Hemminger
  2009-09-22 21:09   ` Stephen Hemminger
  1 sibling, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2009-09-22 21:09 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, Andrew Morton, linux-kernel, linux-pm

On Tue, 22 Sep 2009 21:54:09 +0200
"Rafael J. Wysocki" <rjw@sisk.pl> wrote:

> On Tuesday 22 September 2009, Stephen Hemminger wrote:
> > By marking it cold, then the code path in kernel thread 
> > usage of try_to_freeze() that is normally used be
> > selected.
> 

In the code for try_to_freeze(), for optimization, it might
help to tell the compiler to not favor the code path where
the refigrator is being called.

Another way to do the same thing would be to do.
   if (unlikely(freezing(current))) {
	refrigerator();
	return 1;
   } else
	return 0;

or build unlikely into the freezing function (see need_resched).

I saw this by trying to minimize the number of intstructions
in pktgen which is a special case.

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

* Re: [PATCH] make refrigerator cold
  2009-09-22 21:09   ` Stephen Hemminger
@ 2009-09-22 23:13     ` Rafael J. Wysocki
  2009-09-22 23:19       ` Stephen Hemminger
  2009-09-22 23:19       ` Stephen Hemminger
  2009-09-22 23:13     ` Rafael J. Wysocki
  1 sibling, 2 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2009-09-22 23:13 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Len Brown, Matt Helsley, Andrew Morton, linux-pm, linux-kernel

On Tuesday 22 September 2009, Stephen Hemminger wrote:
> On Tue, 22 Sep 2009 21:54:09 +0200
> "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> 
> > On Tuesday 22 September 2009, Stephen Hemminger wrote:
> > > By marking it cold, then the code path in kernel thread 
> > > usage of try_to_freeze() that is normally used be
> > > selected.
> > 
> 
> In the code for try_to_freeze(), for optimization, it might
> help to tell the compiler to not favor the code path where
> the refigrator is being called.
> 
> Another way to do the same thing would be to do.
>    if (unlikely(freezing(current))) {
> 	refrigerator();
> 	return 1;
>    } else
> 	return 0;
> 
> or build unlikely into the freezing function (see need_resched).
> 
> I saw this by trying to minimize the number of intstructions
> in pktgen which is a special case.

OK, thanks.

Will it be fine with you if I add the patch to the suspend-2.6 tree with the
above information in the changelog?

Rafael

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

* Re: [PATCH] make refrigerator cold
  2009-09-22 21:09   ` Stephen Hemminger
  2009-09-22 23:13     ` Rafael J. Wysocki
@ 2009-09-22 23:13     ` Rafael J. Wysocki
  1 sibling, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2009-09-22 23:13 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Len Brown, Andrew Morton, linux-kernel, linux-pm

On Tuesday 22 September 2009, Stephen Hemminger wrote:
> On Tue, 22 Sep 2009 21:54:09 +0200
> "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> 
> > On Tuesday 22 September 2009, Stephen Hemminger wrote:
> > > By marking it cold, then the code path in kernel thread 
> > > usage of try_to_freeze() that is normally used be
> > > selected.
> > 
> 
> In the code for try_to_freeze(), for optimization, it might
> help to tell the compiler to not favor the code path where
> the refigrator is being called.
> 
> Another way to do the same thing would be to do.
>    if (unlikely(freezing(current))) {
> 	refrigerator();
> 	return 1;
>    } else
> 	return 0;
> 
> or build unlikely into the freezing function (see need_resched).
> 
> I saw this by trying to minimize the number of intstructions
> in pktgen which is a special case.

OK, thanks.

Will it be fine with you if I add the patch to the suspend-2.6 tree with the
above information in the changelog?

Rafael

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

* Re: [PATCH] make refrigerator cold
  2009-09-22 23:13     ` Rafael J. Wysocki
  2009-09-22 23:19       ` Stephen Hemminger
@ 2009-09-22 23:19       ` Stephen Hemminger
  1 sibling, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2009-09-22 23:19 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, Matt Helsley, Andrew Morton, linux-pm, linux-kernel

On Wed, 23 Sep 2009 01:13:20 +0200
"Rafael J. Wysocki" <rjw@sisk.pl> wrote:

> On Tuesday 22 September 2009, Stephen Hemminger wrote:
> > On Tue, 22 Sep 2009 21:54:09 +0200
> > "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> > 
> > > On Tuesday 22 September 2009, Stephen Hemminger wrote:
> > > > By marking it cold, then the code path in kernel thread 
> > > > usage of try_to_freeze() that is normally used be
> > > > selected.
> > > 
> > 
> > In the code for try_to_freeze(), for optimization, it might
> > help to tell the compiler to not favor the code path where
> > the refigrator is being called.
> > 
> > Another way to do the same thing would be to do.
> >    if (unlikely(freezing(current))) {
> > 	refrigerator();
> > 	return 1;
> >    } else
> > 	return 0;
> > 
> > or build unlikely into the freezing function (see need_resched).
> > 
> > I saw this by trying to minimize the number of intstructions
> > in pktgen which is a special case.
> 
> OK, thanks.
> 
> Will it be fine with you if I add the patch to the suspend-2.6 tree with the
> above information in the changelog?
> 
> Rafael

Sure, any of the possibilities works, you choose.

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

* Re: [PATCH] make refrigerator cold
  2009-09-22 23:13     ` Rafael J. Wysocki
@ 2009-09-22 23:19       ` Stephen Hemminger
  2009-09-22 23:19       ` Stephen Hemminger
  1 sibling, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2009-09-22 23:19 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, Andrew Morton, linux-kernel, linux-pm

On Wed, 23 Sep 2009 01:13:20 +0200
"Rafael J. Wysocki" <rjw@sisk.pl> wrote:

> On Tuesday 22 September 2009, Stephen Hemminger wrote:
> > On Tue, 22 Sep 2009 21:54:09 +0200
> > "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> > 
> > > On Tuesday 22 September 2009, Stephen Hemminger wrote:
> > > > By marking it cold, then the code path in kernel thread 
> > > > usage of try_to_freeze() that is normally used be
> > > > selected.
> > > 
> > 
> > In the code for try_to_freeze(), for optimization, it might
> > help to tell the compiler to not favor the code path where
> > the refigrator is being called.
> > 
> > Another way to do the same thing would be to do.
> >    if (unlikely(freezing(current))) {
> > 	refrigerator();
> > 	return 1;
> >    } else
> > 	return 0;
> > 
> > or build unlikely into the freezing function (see need_resched).
> > 
> > I saw this by trying to minimize the number of intstructions
> > in pktgen which is a special case.
> 
> OK, thanks.
> 
> Will it be fine with you if I add the patch to the suspend-2.6 tree with the
> above information in the changelog?
> 
> Rafael

Sure, any of the possibilities works, you choose.

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

end of thread, other threads:[~2009-09-22 23:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-22  4:04 [PATCH] make refrigerator cold Stephen Hemminger
2009-09-22 19:54 ` Rafael J. Wysocki
2009-09-22 19:54 ` Rafael J. Wysocki
2009-09-22 21:09   ` Stephen Hemminger
2009-09-22 21:09   ` Stephen Hemminger
2009-09-22 23:13     ` Rafael J. Wysocki
2009-09-22 23:19       ` Stephen Hemminger
2009-09-22 23:19       ` Stephen Hemminger
2009-09-22 23:13     ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.