Skip to contentSkip to conversation

mm: mempolicy: use VM_BUG_ON_VMA in queue_pages_test_walk()

PATCH Applied Yang Shi 4 participants 10 messages Jan 15, 2020 – Feb 14, 2020

Subsystems (2)
lore
Share & tools
lore

Yang Shi

author
#0 lore raw

PATCH 1/1 mm: mempolicy: use VM_BUG_ON_VMA in queue_pages_test_walk()

The VM_BUG_ON() is already used by queue_pages_test_walk(), it sounds better to dump more debug information by using VM_BUG_ON_VMA() to help debugging.

---
 mm/mempolicy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -1
index 067cf7d..801d45d 100644
@@ -621,7 +621,7 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
 	unsigned long flags = qp->flags;
 
 	/* range check first */
-	VM_BUG_ON((vma->vm_start > start) || (vma->vm_end < end));
+	VM_BUG_ON_VMA((vma->vm_start > start) || (vma->vm_end < end), vma);
 
 	if (!qp->first) {
 		qp->first = vma;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 5 lines · On 2020-01-15 at 14:09 Yang Shi wrote:

The VM_BUG_ON() is already used by queue_pages_test_walk(), it sounds better to dump more debug information by using VM_BUG_ON_VMA() to help debugging.

The .test_walk() is to be called from pagewalk with the rule that 'start' and 'end' must within range of vma, in case the rule is broke, we detect it. This is not quite relevant to a bug of particular vma.

Quoted 21 lines

---
mm/mempolicy.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -2
index 067cf7d..801d45d 100644
@@ -621,7 +621,7 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
 unsigned long flags = qp->flags;
 
 /* range check first */
-	VM_BUG_ON((vma->vm_start > start) || (vma->vm_end < end));
+	VM_BUG_ON_VMA((vma->vm_start > start) || (vma->vm_end < end), vma);
 
 if (!qp->first) {
 qp->first = vma;
--

1.8.3.1

author
#2 lore raw
Quoted 9 lines · Li Xinhai
Quoted 5 lines · On 2020-01-15 at 14:09 Yang Shi wrote:

The VM_BUG_ON() is already used by queue_pages_test_walk(), it sounds better to dump more debug information by using VM_BUG_ON_VMA() to help debugging.

The .test_walk() is to be called from pagewalk with the rule that 'start' and 'end' must within range of vma, in case the rule is broke, we detect it. This is not quite relevant to a bug of particular vma.

But when you run into VMA range check failure, isn't it helpful to dump the VMA range information to ease debugging? And, VM_BUG_ON is already used in the code, I'm supposed the users may prefer more debug information dumped for debug kernel.

Quoted 22 lines
Quoted 22 lines

---
mm/mempolicy.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -2
index 067cf7d..801d45d 100644
@@ -621,7 +621,7 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
 unsigned long flags = qp->flags;
 
 /* range check first */
-	VM_BUG_ON((vma->vm_start > start) || (vma->vm_end < end));
+	VM_BUG_ON_VMA((vma->vm_start > start) || (vma->vm_end < end), vma);
 
 if (!qp->first) {
 qp->first = vma;
--

1.8.3.1

#3 lore raw
Quoted 9 lines · On 2020-01-16 at 01:27 Yang Shi wrote:
Quoted 6 lines · Li Xinhai
Quoted 5 lines · On 2020-01-15 at 14:09 Yang Shi wrote:

The VM_BUG_ON() is already used by queue_pages_test_walk(), it sounds better to dump more debug information by using VM_BUG_ON_VMA() to help debugging.

Quoted 9 lines
Quoted 3 lines

The .test_walk() is to be called from pagewalk with the rule that 'start' and 'end' must within range of vma, in case the rule is broke, we detect it. This is not quite relevant to a bug of particular vma.

But when you run into VMA range check failure, isn't it helpful to dump the VMA range information to ease debugging? And, VM_BUG_ON is already used in the code, I'm supposed the users may prefer more debug information dumped for debug kernel.

Got your point, it is already used better put more information.

Quoted 23 lines
Quoted 22 lines
Quoted 22 lines

---
mm/mempolicy.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -2
index 067cf7d..801d45d 100644
@@ -621,7 +621,7 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
 unsigned long flags = qp->flags;
 
 /* range check first */
-	VM_BUG_ON((vma->vm_start > start) || (vma->vm_end < end));
+	VM_BUG_ON_VMA((vma->vm_start > start) || (vma->vm_end < end), vma);
 
 if (!qp->first) {
 qp->first = vma;
--

1.8.3.1

author
#4 lore raw
Quoted 12 lines · Li Xinhai
Quoted 11 lines · On 2020-01-16 at 01:27 Yang Shi wrote:
Quoted 9 lines · Li Xinhai
Quoted 5 lines · On 2020-01-15 at 14:09 Yang Shi wrote:

The VM_BUG_ON() is already used by queue_pages_test_walk(), it sounds better to dump more debug information by using VM_BUG_ON_VMA() to help debugging.

The .test_walk() is to be called from pagewalk with the rule that 'start' and 'end' must within range of vma, in case the rule is broke, we detect it. This is not quite relevant to a bug of particular vma.

Quoted 6 lines
Quoted 5 lines

But when you run into VMA range check failure, isn't it helpful to dump the VMA range information to ease debugging? And, VM_BUG_ON is already used in the code, I'm supposed the users may prefer more debug information dumped for debug kernel.

Got your point, it is already used better put more information.

Hi Andrew,

Would you like to take this patch for v5.6 or v5.7? It looks Xinhai agrees with my point.

Thanks,
Yang

Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 21 lines

---
mm/mempolicy.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -2
index 067cf7d..801d45d 100644
@@ -621,7 +621,7 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
 unsigned long flags = qp->flags;
 
 /* range check first */
-	VM_BUG_ON((vma->vm_start > start) || (vma->vm_end < end));
+	VM_BUG_ON_VMA((vma->vm_start > start) || (vma->vm_end < end), vma);
 
 if (!qp->first) {
 qp->first = vma;
--

1.8.3.1

#5 lore raw
In reply to Yang Shi
Quoted 7 lines · Yang Shi

The VM_BUG_ON() is already used by queue_pages_test_walk(), it sounds better to dump more debug information by using VM_BUG_ON_VMA() to help debugging.

What’s the problem this is trying to resolve? Was there an existing bug would trigger this?

author
#6 lore raw
Quoted 7 lines · Qian Cai
Quoted 6 lines · Yang Shi

The VM_BUG_ON() is already used by queue_pages_test_walk(), it sounds better to dump more debug information by using VM_BUG_ON_VMA() to help debugging.

What’s the problem this is trying to resolve? Was there an existing bug would trigger this?

Dumping more information to help debugging. I don't run into related bug personally.

#7 lore raw
Quoted 5 lines · Yang Shi

Dumping more information to help debugging. I don't run into related bug personally.

This is a relatively weak justification for merging. If we are keeping accepting those mindless debugging patches, the workload will be unbearable for all.

maintainer
#8 lore raw
Quoted 7 lines · On Mon, 27 Jan 2020 15:23:08 -0500 Qian Cai <[email protected]> wrote:
Quoted 5 lines · Yang Shi

Dumping more information to help debugging. I don't run into related bug personally.

This is a relatively weak justification for merging. If we are keeping accepting those mindless debugging patches, the workload will be unbearable for all.

I think it's OK. If this ever triggers the kernel is dead, so the volume of output isn't a problem. And if it triggers, the more info the better.

#9 lore raw
Quoted 7 lines · Andrew Morton

I think it's OK. If this ever triggers the kernel is dead, so the volume of output isn't a problem. And if it triggers, the more info the better.

Well, I could think of millions of ways to just add more info for those theoretical assertion places where we will eventually be running out of review bandwidth if people start to “abuse” it. Anyway, if maintainers are willing to take risks on that path, I’ll not complain.