* [PATCH] sched: try to fix mm leak when freeing sched groups
@ 2011-04-21 13:37 Hillf Danton
2011-04-21 13:44 ` Peter Zijlstra
0 siblings, 1 reply; 6+ messages in thread
From: Hillf Danton @ 2011-04-21 13:37 UTC (permalink / raw)
To: LKML; +Cc: Ingo Molnar, Peter Zijlstra
When freeing sched groups, there is a sg (== sched_group_nodes[i]) not
got freed.
The relevant code is reshuffled to be clearer, and correct.
Signed-off-by: Hillf Danton <dhillf@gmail.com>
---
--- a/kernel/sched.c 2011-03-30 03:09:48.000000000 +0800
+++ b/kernel/sched.c 2011-04-21 21:09:00.000000000 +0800
@@ -7106,7 +7106,7 @@ static void free_sched_groups(const stru
continue;
for (i = 0; i < nr_node_ids; i++) {
- struct sched_group *oldsg, *sg = sched_group_nodes[i];
+ struct sched_group *sg = sched_group_nodes[i];
cpumask_and(nodemask, cpumask_of_node(i), cpu_map);
if (cpumask_empty(nodemask))
@@ -7114,13 +7114,11 @@ static void free_sched_groups(const stru
if (sg == NULL)
continue;
- sg = sg->next;
-next_sg:
- oldsg = sg;
- sg = sg->next;
- kfree(oldsg);
- if (oldsg != sched_group_nodes[i])
- goto next_sg;
+ do {
+ struct sched_group *next = sg->next;
+ kfree(sg);
+ sg = next;
+ } while (sg != sched_group_nodes[i]);
}
kfree(sched_group_nodes);
sched_group_nodes_bycpu[cpu] = NULL;
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sched: try to fix mm leak when freeing sched groups
2011-04-21 13:37 [PATCH] sched: try to fix mm leak when freeing sched groups Hillf Danton
@ 2011-04-21 13:44 ` Peter Zijlstra
2011-04-21 13:46 ` Hillf Danton
0 siblings, 1 reply; 6+ messages in thread
From: Peter Zijlstra @ 2011-04-21 13:44 UTC (permalink / raw)
To: Hillf Danton; +Cc: LKML, Ingo Molnar
On Thu, 2011-04-21 at 21:37 +0800, Hillf Danton wrote:
> When freeing sched groups, there is a sg (== sched_group_nodes[i]) not
> got freed.
> The relevant code is reshuffled to be clearer, and correct.
The code doesn't even appear to exist, what kernel are you patching?
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---
>
> --- a/kernel/sched.c 2011-03-30 03:09:48.000000000 +0800
> +++ b/kernel/sched.c 2011-04-21 21:09:00.000000000 +0800
> @@ -7106,7 +7106,7 @@ static void free_sched_groups(const stru
> continue;
>
> for (i = 0; i < nr_node_ids; i++) {
> - struct sched_group *oldsg, *sg = sched_group_nodes[i];
> + struct sched_group *sg = sched_group_nodes[i];
>
> cpumask_and(nodemask, cpumask_of_node(i), cpu_map);
> if (cpumask_empty(nodemask))
> @@ -7114,13 +7114,11 @@ static void free_sched_groups(const stru
>
> if (sg == NULL)
> continue;
> - sg = sg->next;
> -next_sg:
> - oldsg = sg;
> - sg = sg->next;
> - kfree(oldsg);
> - if (oldsg != sched_group_nodes[i])
> - goto next_sg;
> + do {
> + struct sched_group *next = sg->next;
> + kfree(sg);
> + sg = next;
> + } while (sg != sched_group_nodes[i]);
> }
> kfree(sched_group_nodes);
> sched_group_nodes_bycpu[cpu] = NULL;
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sched: try to fix mm leak when freeing sched groups
2011-04-21 13:44 ` Peter Zijlstra
@ 2011-04-21 13:46 ` Hillf Danton
2011-04-21 14:20 ` Peter Zijlstra
0 siblings, 1 reply; 6+ messages in thread
From: Hillf Danton @ 2011-04-21 13:46 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: LKML, Ingo Molnar
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 2381 bytes --]
On Thu, Apr 21, 2011 at 9:44 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, 2011-04-21 at 21:37 +0800, Hillf Danton wrote:
>> When freeing sched groups, there is a sg (== sched_group_nodes[i]) not
>> got freed.
>> The relevant code is reshuffled to be clearer, and correct.
>
> The code doesn't even appear to exist, what kernel are you patching?
>
Hi Peter
It is linux-2.6.39-rc1.tar.bz2 downloaded at kernel.org, and
>> --- a/kernel/sched.c  2011-03-30 03:09:48.000000000 +0800
is the time stamp, right?
thanks
Hillf
>> Signed-off-by: Hillf Danton <dhillf@gmail.com>
>> ---
>>
>> --- a/kernel/sched.c  2011-03-30 03:09:48.000000000 +0800
>> +++ b/kernel/sched.c  2011-04-21 21:09:00.000000000 +0800
>> @@ -7106,7 +7106,7 @@ static void free_sched_groups(const stru
>> Â Â Â Â Â Â Â Â Â Â Â continue;
>>
>> Â Â Â Â Â Â Â for (i = 0; i < nr_node_ids; i++) {
>> - Â Â Â Â Â Â Â Â Â Â struct sched_group *oldsg, *sg = sched_group_nodes[i];
>> + Â Â Â Â Â Â Â Â Â Â struct sched_group *sg = sched_group_nodes[i];
>>
>> Â Â Â Â Â Â Â Â Â Â Â cpumask_and(nodemask, cpumask_of_node(i), cpu_map);
>> Â Â Â Â Â Â Â Â Â Â Â if (cpumask_empty(nodemask))
>> @@ -7114,13 +7114,11 @@ static void free_sched_groups(const stru
>>
>> Â Â Â Â Â Â Â Â Â Â Â if (sg == NULL)
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue;
>> - Â Â Â Â Â Â Â Â Â Â sg = sg->next;
>> -next_sg:
>> - Â Â Â Â Â Â Â Â Â Â oldsg = sg;
>> - Â Â Â Â Â Â Â Â Â Â sg = sg->next;
>> - Â Â Â Â Â Â Â Â Â Â kfree(oldsg);
>> - Â Â Â Â Â Â Â Â Â Â if (oldsg != sched_group_nodes[i])
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â goto next_sg;
>> + Â Â Â Â Â Â Â Â Â Â do {
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct sched_group *next = sg->next;
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â kfree(sg);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â sg = next;
>> + Â Â Â Â Â Â Â Â Â Â } while (sg != sched_group_nodes[i]);
>> Â Â Â Â Â Â Â }
>> Â Â Â Â Â Â Â kfree(sched_group_nodes);
>> Â Â Â Â Â Â Â sched_group_nodes_bycpu[cpu] = NULL;
>
>
>
>
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sched: try to fix mm leak when freeing sched groups
2011-04-21 13:46 ` Hillf Danton
@ 2011-04-21 14:20 ` Peter Zijlstra
2011-04-21 14:22 ` Hillf Danton
2011-05-02 2:38 ` Hillf Danton
0 siblings, 2 replies; 6+ messages in thread
From: Peter Zijlstra @ 2011-04-21 14:20 UTC (permalink / raw)
To: Hillf Danton; +Cc: LKML, Ingo Molnar
On Thu, 2011-04-21 at 21:46 +0800, Hillf Danton wrote:
>
> It is linux-2.6.39-rc1.tar.bz2 downloaded at kernel.org, and
> >> --- a/kernel/sched.c 2011-03-30 03:09:48.000000000 +0800
> is the time stamp, right?
Dunno, but 39-rc1 is like ancient, please send patches against the tip
git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sched: try to fix mm leak when freeing sched groups
2011-04-21 14:20 ` Peter Zijlstra
@ 2011-04-21 14:22 ` Hillf Danton
2011-05-02 2:38 ` Hillf Danton
1 sibling, 0 replies; 6+ messages in thread
From: Hillf Danton @ 2011-04-21 14:22 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: LKML, Ingo Molnar
On Thu, Apr 21, 2011 at 10:20 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, 2011-04-21 at 21:46 +0800, Hillf Danton wrote:
>>
>> It is linux-2.6.39-rc1.tar.bz2 downloaded at kernel.org, and
>> >> --- a/kernel/sched.c 2011-03-30 03:09:48.000000000 +0800
>> is the time stamp, right?
>
> Dunno, but 39-rc1 is like ancient, please send patches against the tip
> git tree:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git
>
well, I will try it soon.
thanks
Hillf
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sched: try to fix mm leak when freeing sched groups
2011-04-21 14:20 ` Peter Zijlstra
2011-04-21 14:22 ` Hillf Danton
@ 2011-05-02 2:38 ` Hillf Danton
1 sibling, 0 replies; 6+ messages in thread
From: Hillf Danton @ 2011-05-02 2:38 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: LKML, Ingo Molnar, Yong Zhang
On Thu, Apr 21, 2011 at 10:20 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, 2011-04-21 at 21:46 +0800, Hillf Danton wrote:
>>
>> It is linux-2.6.39-rc1.tar.bz2 downloaded at kernel.org, and
>> >> --- a/kernel/sched.c 2011-03-30 03:09:48.000000000 +0800
>> is the time stamp, right?
>
> Dunno, but 39-rc1 is like ancient, please send patches against the tip
> git tree:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git
>
Hi Peter
I tried again, and please review once more.
thanks
Hillf
---
--- linux-2.6.39-rc5/kernel/sched.c 2011-04-27 11:48:50.000000000 +0800
+++ sched.c 2011-05-02 10:38:02.000000000 +0800
@@ -7120,21 +7120,18 @@ static void free_sched_groups(const stru
continue;
for (i = 0; i < nr_node_ids; i++) {
- struct sched_group *oldsg, *sg = sched_group_nodes[i];
+ struct sched_group *sg = sched_group_nodes[i];
cpumask_and(nodemask, cpumask_of_node(i), cpu_map);
if (cpumask_empty(nodemask))
continue;
- if (sg == NULL)
- continue;
- sg = sg->next;
-next_sg:
- oldsg = sg;
- sg = sg->next;
- kfree(oldsg);
- if (oldsg != sched_group_nodes[i])
- goto next_sg;
+ if (sg != NULL)
+ do {
+ struct sched_group *next = sg->next;
+ kfree(sg);
+ sg = next;
+ } while (sg != sched_group_nodes[i]);
}
kfree(sched_group_nodes);
sched_group_nodes_bycpu[cpu] = NULL;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-05-02 2:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-21 13:37 [PATCH] sched: try to fix mm leak when freeing sched groups Hillf Danton
2011-04-21 13:44 ` Peter Zijlstra
2011-04-21 13:46 ` Hillf Danton
2011-04-21 14:20 ` Peter Zijlstra
2011-04-21 14:22 ` Hillf Danton
2011-05-02 2:38 ` Hillf Danton
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.