Skip to contentSkip to conversation

kernel/freezer.c : Removing extra checking.

PATCH In review Rakib Mullick 3 participants 6 messages Dec 6, 2008 – Dec 12, 2008 Freezer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/freezer.c : Removing extra checking.

Impact: Reduces an extra checking.

Following patch removes an extra checking. We can remove it since, the current task is frozen. If the current task is not frozen, then it will return from __else__ condition of freezing(current) check. So, the check becames unnecessary. It also reduces 32 bytes of text space on my x86 (32 bit) system.

kernel/freezer.c +0 -2
@@ -46,8 +46,6 @@ void refrigerator(void)
 
 	for (;;) {
 		set_current_state(TASK_UNINTERRUPTIBLE);
-		if (!frozen(current))
-			break;
 		schedule();
 	}
 	pr_debug("%s left refrigerator\n", current->comm);
#1 lore raw
Quoted 7 lines · Rakib Mullick

Impact: Reduces an extra checking.

Following patch removes an extra checking. We can remove it since, the current task is frozen. If the current task is not frozen, then it will return from __else__ condition of freezing(current) check. So, the check becames unnecessary. It also reduces 32 bytes of text space on my x86 (32 bit) system.

What will happen with this patch applied when a task is woken up for some reason other than thawing?

Quoted 14 lines
kernel/freezer.c +0 -3
@@ -46,8 +46,6 @@ void refrigerator(void)
 
 	for (;;) {
 		set_current_state(TASK_UNINTERRUPTIBLE);
-		if (!frozen(current))
-			break;
 		schedule();
 	}
 	pr_debug("%s left refrigerator\n", current->comm);
--
#2 lore raw
Quoted 10 lines · Rafael J. Wysocki
Quoted 7 lines · Rakib Mullick

Impact: Reduces an extra checking.

Following patch removes an extra checking. We can remove it since, the current task is frozen. If the current task is not frozen, then it will return from __else__ condition of freezing(current) check. So, the check becames unnecessary. It also reduces 32 bytes of text space on my x86 (32 bit) system.

Quoted 2 lines

What will happen with this patch applied when a task is woken up for some
reason other than thawing?

thawing is usually used for woken up a frozzen process. Would you please tell me what are the other ways to woken up a frozzen process? Am I missing anything ?
Thanks,

Quoted 17 lines
Quoted 16 lines
kernel/freezer.c 2008-12-05 19:55:40.000000000 +0600 renamed from kernel/freezer.c 2008-12-05 19:53:45.000000000 +0600 +0 -3
@@ -46,8 +46,6 @@ void refrigerator(void)
 
      for (;;) {
              set_current_state(TASK_UNINTERRUPTIBLE);
-             if (!frozen(current))
-                     break;
              schedule();
      }
      pr_debug("%s left refrigerator\n", current->comm);
 
--
#3 lore raw
Quoted 11 lines · Rakib Mullick
Quoted 10 lines · Rafael J. Wysocki
Quoted 7 lines · Rakib Mullick

Impact: Reduces an extra checking.

Following patch removes an extra checking. We can remove it since, the current task is frozen. If the current task is not frozen, then it will return from __else__ condition of freezing(current) check. So, the check becames unnecessary. It also reduces 32 bytes of text space on my x86 (32 bit) system.

Quoted 5 lines
Quoted 2 lines

What will happen with this patch applied when a task is woken up for some
reason other than thawing?

thawing is usually used for woken up a frozzen process. Would you please tell me what are the other ways to woken up a frozzen process? Am I missing anything ?

Well, in theory the process can be woken up for another reason.

I don't have any particular examples in mind, but in this case the burden is yours to show that it won't happen and to say why exactly you think so in the changelog, because this is the very reason why the code has been written this way in the first place.

Thanks,
Rafael

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
kernel/freezer.c 2008-12-05 19:55:40.000000000 +0600 renamed from kernel/freezer.c 2008-12-05 19:53:45.000000000 +0600 +0 -3
@@ -46,8 +46,6 @@ void refrigerator(void)
 
      for (;;) {
              set_current_state(TASK_UNINTERRUPTIBLE);
-             if (!frozen(current))
-                     break;
              schedule();
      }
      pr_debug("%s left refrigerator\n", current->comm);
 
--
#4 lore raw
Quoted 12 lines · Rafael J. Wysocki
Quoted 11 lines · Rakib Mullick
Quoted 10 lines · Rafael J. Wysocki
Quoted 7 lines · Rakib Mullick

Impact: Reduces an extra checking.

Following patch removes an extra checking. We can remove it since, the current task is frozen. If the current task is not frozen, then it will return from __else__ condition of freezing(current) check. So, the check becames unnecessary. It also reduces 32 bytes of text space on my x86 (32 bit) system.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

What will happen with this patch applied when a task is woken up for some
reason other than thawing?

thawing is usually used for woken up a frozzen process. Would you please tell me what are the other ways to woken up a frozzen process? Am I missing anything ?

Well, in theory the process can be woken up for another reason.

...like pending signal...

Quoted 5 lines

I don't have any particular examples in mind, but in this case the burden is yours to show that it won't happen and to say why exactly you think so in the changelog, because this is the very reason why the code has been written this way in the first place.

Quoted 18 lines

Thanks,
Rafael

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
kernel/freezer.c 2008-12-05 19:55:40.000000000 +0600 renamed from kernel/freezer.c 2008-12-05 19:53:45.000000000 +0600 +0 -2
@@ -46,8 +46,6 @@ void refrigerator(void)
 
      for (;;) {
              set_current_state(TASK_UNINTERRUPTIBLE);
-             if (!frozen(current))
-                     break;
              schedule();
      }
      pr_debug("%s left refrigerator\n", current->comm);

Plus this looks like infinite loop after your change. Have you tested it?

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#5 lore raw
Quoted 3 lines · Pavel Machek

Plus this looks like infinite loop after your change. Have you tested
it?

No. I haven't tested it. But very soon I'll try to test it. Well, you said pending signal. What will happen when a pending signal will send. In current code check is made to make sure that the task is frozen or not. I mean , when a signal is send ( from theoritical POV, which could be any ) this code doesn't make sure what will happen to that perticular process.
It is already a infinite loop, the check is made to make sure that whether the task will be scheduled or not.

Thanks,
Rakib

Quoted 6 lines

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html