Skip to contentSkip to conversation

make refrigerator cold

PATCH In review Stephen Hemminger 2 participants 9 messages Sep 22, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make refrigerator cold

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.

include/linux/freezer.h +1 -1
@@ -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);
 
#1 lore raw
Quoted 3 lines · Stephen Hemminger

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?

Quoted 2 lines

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

Well, yeah.

Quoted 13 lines
include/linux/freezer.h +1 -1
@@ -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);
#2 lore raw
Quoted 5 lines · On Tue, 22 Sep 2009 21:54:09 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

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.

#3 lore raw
In reply to Rafael J. Wysocki
Quoted 5 lines · On Tue, 22 Sep 2009 21:54:09 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

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.

#4 lore raw
Quoted 20 lines · Stephen Hemminger
Quoted 5 lines · On Tue, 22 Sep 2009 21:54:09 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

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;
Quoted 4 lines

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

#5 lore raw
Quoted 26 lines · On Wed, 23 Sep 2009 01:13:20 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 20 lines · Stephen Hemminger
Quoted 5 lines · On Tue, 22 Sep 2009 21:54:09 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

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;
Quoted 4 lines

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.

Quoted 6 lines

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.

#6 lore raw
In reply to Rafael J. Wysocki
Quoted 26 lines · On Wed, 23 Sep 2009 01:13:20 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 20 lines · Stephen Hemminger
Quoted 5 lines · On Tue, 22 Sep 2009 21:54:09 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

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;
Quoted 4 lines

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.

Quoted 6 lines

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.

#7 lore raw
In reply to Stephen Hemminger
Quoted 20 lines · Stephen Hemminger
Quoted 5 lines · On Tue, 22 Sep 2009 21:54:09 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

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;
Quoted 4 lines

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

#8 lore raw
In reply to Stephen Hemminger
Quoted 3 lines · Stephen Hemminger

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?

Quoted 2 lines

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

Well, yeah.

Quoted 13 lines
include/linux/freezer.h +1 -1
@@ -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);