Skip to contentSkip to conversation

memcgroup: fix typo in VM_BUG_ON()

PATCH In review Li Zefan 8 participants 21 messages Feb 18, 2008 7 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 2/3 memcgroup: fix typo in VM_BUG_ON()

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

---
 mm/memcontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +1 -1
index 6bded84..c2959ee 100644
@@ -534,7 +534,7 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
+		VM_BUG_ON(!page);
 
 		if (unlikely(!PageLRU(page)))
 			continue;
Signature · 1 line
1.5.4.rc3

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
In reply to a message not in the archive
Quoted 14 lines

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

---
 mm/memcontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -0
index 6bded84..c2959ee 100644

mm/memcontrol.c unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, · line 537

Quoted 5 lines
mm/memcontrol.c +1 -1
@@ -534,7 +534,7 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
+		VM_BUG_ON(!page);

can't page be NULL here if mem_cgroup_uncharge clears pc->page behind us? ie. bug.

YAMAMOTO Takashi

#5 lore raw
Quoted 9 lines
Quoted 5 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

Quoted 12 lines
Signature · 9 lines
-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

A message that is not in the archive (sent off-list or not yet received): 20080218062209.DA59B1E3C58-Pcsii4f/[email protected]

#7 lore raw
Quoted 4 lines · YAMAMOTO Takashi
Quoted 4 lines
Quoted 3 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
#8 lore raw
In reply to YAMAMOTO Takashi
Quoted 4 lines · YAMAMOTO Takashi
Quoted 4 lines
Quoted 3 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

A message that is not in the archive (sent off-list or not yet received): 47B923C8.3090904-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org

#10 lore raw
Quoted 7 lines · Balbir Singh
Quoted 6 lines · YAMAMOTO Takashi
Quoted 6 lines
Quoted 5 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.

No, 'pc' has been dereferenced in list_for_each_entry_safe_reverse().

#define list_for_each_entry_safe_reverse(pos, n, head, member)		\
	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
		n = list_entry(pos->member.prev, typeof(*pos), member);	\
                               ^^^^^^^^^^^
	     &pos->member != (head); 					\
              ^^^^^^^^^^^
	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))
author
#11 lore raw
In reply to Balbir Singh
Quoted 7 lines · Balbir Singh
Quoted 6 lines · YAMAMOTO Takashi
Quoted 6 lines
Quoted 5 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.

No, 'pc' has been dereferenced in list_for_each_entry_safe_reverse().

#define list_for_each_entry_safe_reverse(pos, n, head, member)		\
	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
		n = list_entry(pos->member.prev, typeof(*pos), member);	\
                               ^^^^^^^^^^^
	     &pos->member != (head); 					\
              ^^^^^^^^^^^
	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw
Quoted 20 lines · Li Zefan
Quoted 7 lines · Balbir Singh
Quoted 6 lines · YAMAMOTO Takashi
Quoted 6 lines
Quoted 5 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.

No, 'pc' has been dereferenced in list_for_each_entry_safe_reverse().

Quoted 8 lines
#define list_for_each_entry_safe_reverse(pos, n, head, member)		\
	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
		n = list_entry(pos->member.prev, typeof(*pos), member);	\
                               ^^^^^^^^^^^
	     &pos->member != (head); 					\
              ^^^^^^^^^^^
	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))

Hmm.. We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
#14 lore raw
In reply to Li Zefan
Quoted 20 lines · Li Zefan
Quoted 7 lines · Balbir Singh
Quoted 6 lines · YAMAMOTO Takashi
Quoted 6 lines
Quoted 5 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.

No, 'pc' has been dereferenced in list_for_each_entry_safe_reverse().

Quoted 8 lines
#define list_for_each_entry_safe_reverse(pos, n, head, member)		\
	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
		n = list_entry(pos->member.prev, typeof(*pos), member);	\
                               ^^^^^^^^^^^
	     &pos->member != (head); 					\
              ^^^^^^^^^^^
	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))

Hmm.. We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

A message that is not in the archive (sent off-list or not yet received): 47B92D47.2050008-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org

#16 lore raw
Quoted 29 lines · Balbir Singh
Quoted 19 lines · Li Zefan
Quoted 7 lines · Balbir Singh
Quoted 6 lines · YAMAMOTO Takashi
Quoted 6 lines
Quoted 5 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.

No, 'pc' has been dereferenced in list_for_each_entry_safe_reverse().

Quoted 8 lines
#define list_for_each_entry_safe_reverse(pos, n, head, member)		\
	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
		n = list_entry(pos->member.prev, typeof(*pos), member);	\
                               ^^^^^^^^^^^
	     &pos->member != (head); 					\
              ^^^^^^^^^^^
	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))
Quoted 5 lines

Hmm.. We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

I see, and I'll post a new patch to just remove it.

#17 lore raw

PATCH 1/1 memcgroup: remove a useless VM_BUG_ON()

In reply to a message not in the archive

Remove this VM_BUG_ON(), as Balbir stated:

We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

---
 mm/memcontrol.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -1
index 718acf8..631002d 100644
@@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
 
 		if (unlikely(!PageLRU(page)))
 			continue;
Signature · 1 line
1.5.4.rc3
author
#18 lore raw
In reply to Balbir Singh
Quoted 29 lines · Balbir Singh
Quoted 19 lines · Li Zefan
Quoted 7 lines · Balbir Singh
Quoted 6 lines · YAMAMOTO Takashi
Quoted 6 lines
Quoted 5 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

OK, so the VM_BUG_ON needs to move to an earlier location. Agreed.

No, 'pc' has been dereferenced in list_for_each_entry_safe_reverse().

Quoted 8 lines
#define list_for_each_entry_safe_reverse(pos, n, head, member)		\
	for (pos = list_entry((head)->prev, typeof(*pos), member),	\
		n = list_entry(pos->member.prev, typeof(*pos), member);	\
                               ^^^^^^^^^^^
	     &pos->member != (head); 					\
              ^^^^^^^^^^^
	     pos = n, n = list_entry(n->member.prev, typeof(*n), member))
Quoted 5 lines

Hmm.. We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

I see, and I'll post a new patch to just remove it.

author
#19 lore raw

PATCH 1/1 memcgroup: remove a useless VM_BUG_ON()

In reply to Balbir Singh

Remove this VM_BUG_ON(), as Balbir stated:

We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

---
 mm/memcontrol.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -1
index 718acf8..631002d 100644
@@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
 
 		if (unlikely(!PageLRU(page)))
 			continue;
Signature · 1 line
1.5.4.rc3

A message that is not in the archive (sent off-list or not yet received): [email protected]

Acked-by
#21 lore raw

Re: [PATCH] memcgroup: remove a useless VM_BUG_ON()

Quoted 16 lines · Li Zefan

Remove this VM_BUG_ON(), as Balbir stated:

We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

---
 mm/memcontrol.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -0
index 718acf8..631002d 100644

mm/memcontrol.c unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, · line 539

Quoted 7 lines
mm/memcontrol.c +0 -1
@@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
 
 		if (unlikely(!PageLRU(page)))
 			continue;

This seems much better

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
#22 lore raw

Re: [PATCH] memcgroup: remove a useless VM_BUG_ON()

In reply to a message not in the archive
Quoted 26 lines · On Mon, 18 Feb 2008 15:34:48 +0800 Li Zefan…

Remove this VM_BUG_ON(), as Balbir stated:

We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

---
 mm/memcontrol.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -1
index 718acf8..631002d 100644
@@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
 
 		if (unlikely(!PageLRU(page)))
 			continue;
Signature · 1 line
1.5.4.rc3

Thanks,
-Kame

Acked-by on v1 1/1
#23 lore raw

Re: [PATCH] memcgroup: remove a useless VM_BUG_ON()

In reply to Li Zefan
Quoted 16 lines · Li Zefan

Remove this VM_BUG_ON(), as Balbir stated:

We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

---
 mm/memcontrol.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -0
index 718acf8..631002d 100644

mm/memcontrol.c unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, · line 539

Quoted 7 lines
mm/memcontrol.c +0 -1
@@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
 
 		if (unlikely(!PageLRU(page)))
 			continue;

This seems much better

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
Acked-by on v1 1/1
#24 lore raw

Re: [PATCH] memcgroup: remove a useless VM_BUG_ON()

In reply to Li Zefan
Quoted 26 lines · On Mon, 18 Feb 2008 15:34:48 +0800 Li Zefan <[email protected]> wrote:

Remove this VM_BUG_ON(), as Balbir stated:

We used to have a for loop with !list_empty() as a termination condition and VM_BUG_ON(!pc) is a spill over. With the new loop, VM_BUG_ON(!pc) does not make sense.

---
 mm/memcontrol.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -1
index 718acf8..631002d 100644
@@ -534,7 +534,6 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
 
 		if (unlikely(!PageLRU(page)))
 			continue;
Signature · 1 line
1.5.4.rc3

Thanks,
-Kame

A message that is not in the archive (sent off-list or not yet received): 47B9223C.9020106-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org

#26 lore raw
Quoted 9 lines
Quoted 5 lines · Li Zefan

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

pc is of type page_cgroup and we use list_for_each_entry_safe_reverse. Not sure why we can't bug on pc.

pc is dereferenced before this VM_BUG_ON.

YAMAMOTO Takashi

Quoted 12 lines
Signature · 9 lines
-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
#27 lore raw
In reply to Li Zefan
Quoted 14 lines

No need for VM_BUG_ON(pc), since 'pc' is the list entry. This should be VM_BUG_ON(page).

---
 mm/memcontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -0
index 6bded84..c2959ee 100644

mm/memcontrol.c unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, · line 537

Quoted 5 lines
mm/memcontrol.c +1 -1
@@ -534,7 +534,7 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 		if (scan >= nr_to_scan)
 			break;
 		page = pc->page;
-		VM_BUG_ON(!pc);
+		VM_BUG_ON(!page);

can't page be NULL here if mem_cgroup_uncharge clears pc->page behind us? ie. bug.

YAMAMOTO Takashi