Skip to contentSkip to conversation

pwm: Remove unnecessary OOM messages

PATCH Superseded Jingoo Han 6 participants 28 messages Feb 26, 2014 – May 21, 2014

Subsystems (5)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

cover pwm: Remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. For example, k.alloc and v.alloc failures use dump_stack().

Jingoo Han (9):
pwm: ab8500: Remove unnecessary OOM messages
pwm: i.MX: Remove unnecessary OOM messages
pwm: pxa: Remove unnecessary OOM messages
pwm: renesas-tpu: Remove unnecessary OOM messages
pwm: spear: Remove unnecessary OOM messages
pwm: tegra: Remove unnecessary OOM messages
pwm: pwm-tiecap: Remove unnecessary OOM messages
pwm: tiehrpwm: Remove unnecessary OOM messages
pwm: vt8500: Remove unnecessary OOM messages

---
 drivers/pwm/pwm-ab8500.c      |    4 +---
 drivers/pwm/pwm-imx.c         |    4 +---
 drivers/pwm/pwm-pxa.c         |    4 +---
 drivers/pwm/pwm-renesas-tpu.c |    4 +---
 drivers/pwm/pwm-spear.c       |    4 +---
 drivers/pwm/pwm-tegra.c       |    4 +---
 drivers/pwm/pwm-tiecap.c      |    4 +---
 drivers/pwm/pwm-tiehrpwm.c    |    4 +---
 drivers/pwm/pwm-vt8500.c      |    4 +---
 9 files changed, 9 insertions(+), 27 deletions(-)
author
#1 lore raw

PATCH 1/9 pwm: ab8500: Remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-ab8500.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-ab8500.c +1 -3
index 1d07a6f..9d53e8e 100644
@@ -101,10 +101,8 @@ static int ab8500_pwm_probe(struct platform_device *pdev)
 	 * device which is required for ab8500 read and write
 	 */
 	ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL);
-	if (ab8500 == NULL) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (ab8500 == NULL)
 		return -ENOMEM;
-	}
 
 	ab8500->chip.dev = &pdev->dev;
 	ab8500->chip.ops = &ab8500_pwm_ops;
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH 2/9 pwm: i.MX: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-imx.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-imx.c +1 -3
index cc47733..d797c7b 100644
@@ -241,10 +241,8 @@ static int imx_pwm_probe(struct platform_device *pdev)
 		return -ENODEV;
 
 	imx = devm_kzalloc(&pdev->dev, sizeof(*imx), GFP_KERNEL);
-	if (imx == NULL) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (imx == NULL)
 		return -ENOMEM;
-	}
 
 	imx->clk_per = devm_clk_get(&pdev->dev, "per");
 	if (IS_ERR(imx->clk_per)) {
Signature · 1 line
1.7.10.4
author
#3 lore raw

PATCH 3/9 pwm: pxa: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-pxa.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-pxa.c +1 -3
index 8d99573..f1e8692 100644
@@ -179,10 +179,8 @@ static int pwm_probe(struct platform_device *pdev)
 		return -EINVAL;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
-	if (pwm == NULL) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (pwm == NULL)
 		return -ENOMEM;
-	}
 
 	pwm->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pwm->clk))
Signature · 1 line
1.7.10.4
author
#4 lore raw

PATCH 4/9 pwm: renesas-tpu: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-renesas-tpu.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-renesas-tpu.c +1 -3
index aff6ba9..cc13ff4 100644
@@ -405,10 +405,8 @@ static int tpu_probe(struct platform_device *pdev)
 	int ret;
 
 	tpu = devm_kzalloc(&pdev->dev, sizeof(*tpu), GFP_KERNEL);
-	if (tpu == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (tpu == NULL)
 		return -ENOMEM;
-	}
 
 	spin_lock_init(&tpu->lock);
 	tpu->pdev = pdev;
Signature · 1 line
1.7.10.4
#5 lore raw

Re: [PATCH 4/9] pwm: renesas-tpu: Remove unnecessary OOM messages

Hi Jingoo,

Thank you for the patch.

Quoted 2 lines · On Wednesday 26 February 2014 10:08:10 Jingoo Han wrote:

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

While an allocation failure for such a small piece of memory will mean that we're in trouble far too big for an error message to matter, have you made sure that all devm_kzalloc() error paths lead to an OOM message being printed ?

Quoted 21 lines
---
 drivers/pwm/pwm-renesas-tpu.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-renesas-tpu.c +1 -3
index aff6ba9..cc13ff4 100644
@@ -405,10 +405,8 @@ static int tpu_probe(struct platform_device *pdev)
 	int ret;
 
 	tpu = devm_kzalloc(&pdev->dev, sizeof(*tpu), GFP_KERNEL);
-	if (tpu == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (tpu == NULL)
 		return -ENOMEM;
-	}
 
 	spin_lock_init(&tpu->lock);
 	tpu->pdev = pdev;
Signature · 3 lines
Regards,

Laurent Pinchart
author
#6 lore raw

Re: [PATCH 4/9] pwm: renesas-tpu: Remove unnecessary OOM messages

Quoted 8 lines · Laurent Pinchart
Quoted 2 lines · On Wednesday 26 February 2014 10:08:10 Jingoo Han wrote:

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

While an allocation failure for such a small piece of memory will mean that we're in trouble far too big for an error message to matter, have you made sure that all devm_kzalloc() error paths lead to an OOM message being printed ?

(+cc Joe Perches, Andrew Morton)

Hi Laurent Pinchart,
Long time no see! Thank you for your comment.
I am not sure that I understand your question exactly. I believe that all devm_kzalloc() error paths lead to an OOM message being printed, because k.alloc and v.alloc failures use dump_stack().

Joe Perches,
Would you add some comments on this?
If I am wrong, please let me know.

Best regards,
Jingoo Han

Quoted 22 lines
Quoted 22 lines
---
 drivers/pwm/pwm-renesas-tpu.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-renesas-tpu.c +1 -3
index aff6ba9..cc13ff4 100644
@@ -405,10 +405,8 @@ static int tpu_probe(struct platform_device *pdev)
 	int ret;
 
 	tpu = devm_kzalloc(&pdev->dev, sizeof(*tpu), GFP_KERNEL);
-	if (tpu == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (tpu == NULL)
 		return -ENOMEM;
-	}
 
 	spin_lock_init(&tpu->lock);
 	tpu->pdev = pdev;
#7 lore raw

Re: [PATCH 4/9] pwm: renesas-tpu: Remove unnecessary OOM messages

Hi Jingoo,

Quoted 10 lines · On Wednesday 26 February 2014 11:34:54 Jingoo Han wrote:
Quoted 8 lines · Laurent Pinchart
Quoted 2 lines · On Wednesday 26 February 2014 10:08:10 Jingoo Han wrote:

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

While an allocation failure for such a small piece of memory will mean that we're in trouble far too big for an error message to matter, have you made sure that all devm_kzalloc() error paths lead to an OOM message being printed ?

Quoted 4 lines

(+cc Joe Perches, Andrew Morton)

Hi Laurent Pinchart,
Long time no see! Thank you for your comment.

You're welcome.

Quoted 4 lines

I am not sure that I understand your question exactly. I believe that all devm_kzalloc() error paths lead to an OOM message being printed, because k.alloc and v.alloc failures use dump_stack().

There's so many error code paths in the slab allocator that I got a bit lost, I was just wondering if all of them ended up with a message being printed. It's very probably needless worrying from my side.

Quoted 30 lines

Joe Perches,
Would you add some comments on this?
If I am wrong, please let me know.

Best regards,
Jingoo Han

Quoted 23 lines
Quoted 23 lines

---

 drivers/pwm/pwm-renesas-tpu.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-renesas-tpu.c +1 -3
index aff6ba9..cc13ff4 100644
@@ -405,10 +405,8 @@ static int tpu_probe(struct platform_device *pdev)
 	int ret;
 
 	tpu = devm_kzalloc(&pdev->dev, sizeof(*tpu), GFP_KERNEL);
-	if (tpu == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (tpu == NULL)
 		return -ENOMEM;
-	}
 
 	spin_lock_init(&tpu->lock);
 	tpu->pdev = pdev;
Signature · 3 lines
Regards,

Laurent Pinchart
author
#8 lore raw

PATCH 5/9 pwm: spear: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-spear.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-spear.c +1 -3
index 8ad26b8..b4f6d0d 100644
@@ -179,10 +179,8 @@ static int spear_pwm_probe(struct platform_device *pdev)
 	u32 val;
 
 	pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
-	if (!pc) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (!pc)
 		return -ENOMEM;
-	}
 
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
Signature · 1 line
1.7.10.4
#9 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 13 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-spear.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-spear.c +0 -0
index 8ad26b8..b4f6d0d 100644

drivers/pwm/pwm-spear.c static int spear_pwm_probe(struct platform_device *pdev) · line 183

Quoted 5 lines
drivers/pwm/pwm-spear.c +0 -2
@@ -179,10 +179,8 @@ static int spear_pwm_probe(struct platform_device *pdev)
        u32 val;
 
        pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
-       if (!pc) {
-               dev_err(&pdev->dev, "failed to allocate memory\n");

Can you please pin point which/file line will print similar message ?

author
#10 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 16 lines · Viresh Kumar
Quoted 15 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-spear.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-spear.c +0 -0
index 8ad26b8..b4f6d0d 100644
@@ -179,10 +179,8 @@ static int spear_pwm_probe(struct platform_device *pdev)
        u32 val;
 
Quoted 5 lines

drivers/pwm/pwm-spear.c static int spear_pwm_probe(struct platform_device *pdev) · line 183

Quoted 3 lines
drivers/pwm/pwm-spear.c +0 -2
        pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
-       if (!pc) {
-               dev_err(&pdev->dev, "failed to allocate memory\n");

Can you please pin point which/file line will print similar message ?

(+cc Joe Perches, Andrew Morton)

Sorry, I cannot pin point the exact file line. As far as I know, the similar message will be printed, because k.alloc and v.alloc failures use dump_stack().

Best regards,
Jingoo Han

#11 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 23 lines · Jingoo Han
Quoted 16 lines · Viresh Kumar
Quoted 15 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-spear.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-spear.c +0 -0
index 8ad26b8..b4f6d0d 100644
@@ -179,10 +179,8 @@ static int spear_pwm_probe(struct platform_device *pdev)
        u32 val;
 
Quoted 5 lines

drivers/pwm/pwm-spear.c static int spear_pwm_probe(struct platform_device *pdev) · line 183

Quoted 3 lines
drivers/pwm/pwm-spear.c +0 -2
        pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
-       if (!pc) {
-               dev_err(&pdev->dev, "failed to allocate memory\n");

Can you please pin point which/file line will print similar message ?

Quoted 5 lines

(+cc Joe Perches, Andrew Morton)

Sorry, I cannot pin point the exact file line. As far as I know, the similar message will be printed, because k.alloc and v.alloc failures use dump_stack().

I have tried tracing calls here and I am unable to find any such prints from these routines for majority of failure paths. So its better somebody tells me that I am wrong here :)

#12 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 26 lines · Viresh Kumar
Quoted 25 lines · Jingoo Han
Quoted 16 lines · Viresh Kumar
Quoted 15 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-spear.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-spear.c +0 -0
index 8ad26b8..b4f6d0d 100644
@@ -179,10 +179,8 @@ static int spear_pwm_probe(struct platform_device *pdev)
        u32 val;
 
Quoted 5 lines

drivers/pwm/pwm-spear.c static int spear_pwm_probe(struct platform_device *pdev) · line 183

Quoted 3 lines
drivers/pwm/pwm-spear.c +0 -2
        pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
-       if (!pc) {
-               dev_err(&pdev->dev, "failed to allocate memory\n");

Can you please pin point which/file line will print similar message ?

(+cc Joe Perches, Andrew Morton)

Quoted 8 lines
Quoted 3 lines

Sorry, I cannot pin point the exact file line. As far as I know, the similar message will be printed, because k.alloc and v.alloc failures use dump_stack().

I have tried tracing calls here and I am unable to find any such prints from these routines for majority of failure paths. So its better somebody tells me that I am wrong here :)

Look at warn_alloc_failed() in mm/page_alloc.c

#13 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 1 line · Joe Perches

Look at warn_alloc_failed() in mm/page_alloc.c

Okay, there is a print there. But I am not able to reach to this routine from devm_kzalloc().

devm_kzalloc() <linux/device.h>
devm_kmalloc() <drivers/base/devres.c>
alloc_dr() <drivers/base/devres.c>
kmalloc_track_caller() <linux/slab.h> __kmalloc_track_caller() <mm/slab,slub/slob.c> Taking slab as example:
__do_kmalloc() <mm/slab.c>
...

I can see cases where NULL is returned after above paths and the function you mentioned wasn't there. So, I am not sure that we will get a print for sure for any error that might occur from devm_kzalloc().

author
#14 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 6 lines · Viresh Kumar
Quoted 1 line · Joe Perches

Look at warn_alloc_failed() in mm/page_alloc.c

Okay, there is a print there. But I am not able to reach to this routine from devm_kzalloc().

Quoted 6 lines

devm_kzalloc() <linux/device.h>
devm_kmalloc() <drivers/base/devres.c>
alloc_dr() <drivers/base/devres.c>
kmalloc_track_caller() <linux/slab.h> __kmalloc_track_caller() <mm/slab,slub/slob.c> Taking slab as example:
__do_kmalloc() <mm/slab.c>

(+CC Laurent Pinchart, Dan Carpenter)

Right, I also cannot find that warn_alloc_failed() is called, during devm_kzalloc().

However, in the case of vmalloc(), warn_alloc_failed() is called as below.

./mm/vmalloc.c
vmalloc()
__vmalloc_node_flags()
__vmalloc_node()
__vmalloc_node_range()

./mm/page_alloc.c
warn_alloc_failed()

Quoted 5 lines

...

I can see cases where NULL is returned after above paths and the function you mentioned wasn't there. So, I am not sure that we will get a print for sure for any error that might occur from devm_kzalloc().

I guess that slab_out_of_memory() <./mm/slub.c> may print it for any errors. But, I am not sure. :-(

Joe Perches,
Would you confirm this?

Best regards,
Jingoo Han

#15 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 31 lines · Jingoo Han
Quoted 6 lines · Viresh Kumar
Quoted 1 line · Joe Perches

Look at warn_alloc_failed() in mm/page_alloc.c

Okay, there is a print there. But I am not able to reach to this routine from devm_kzalloc().

Quoted 6 lines

devm_kzalloc() <linux/device.h>
devm_kmalloc() <drivers/base/devres.c>
alloc_dr() <drivers/base/devres.c>
kmalloc_track_caller() <linux/slab.h> __kmalloc_track_caller() <mm/slab,slub/slob.c> Taking slab as example:
__do_kmalloc() <mm/slab.c>

(+CC Laurent Pinchart, Dan Carpenter)

Right, I also cannot find that warn_alloc_failed() is called, during devm_kzalloc().

However, in the case of vmalloc(), warn_alloc_failed() is called as below.

./mm/vmalloc.c
vmalloc()
__vmalloc_node_flags()
__vmalloc_node()
__vmalloc_node_range()

./mm/page_alloc.c
warn_alloc_failed()

Quoted 9 lines
Quoted 5 lines

...

I can see cases where NULL is returned after above paths and the function you mentioned wasn't there. So, I am not sure that we will get a print for sure for any error that might occur from devm_kzalloc().

I guess that slab_out_of_memory() <./mm/slub.c> may print it for any errors. But, I am not sure. :-(

devm_kzalloc() is just kmalloc(). The OOM error messages are the same.

regards,
dan carpenter

#16 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Hi Dan,

Quoted 34 lines · On Monday 03 March 2014 12:53:11 Dan Carpenter wrote:
Quoted 33 lines · Jingoo Han
Quoted 6 lines · Viresh Kumar
Quoted 1 line · Joe Perches

Look at warn_alloc_failed() in mm/page_alloc.c

Okay, there is a print there. But I am not able to reach to this routine from devm_kzalloc().

Quoted 6 lines

devm_kzalloc() <linux/device.h>
devm_kmalloc() <drivers/base/devres.c>
alloc_dr() <drivers/base/devres.c>
kmalloc_track_caller() <linux/slab.h> __kmalloc_track_caller() <mm/slab,slub/slob.c> Taking slab as example:
__do_kmalloc() <mm/slab.c>

(+CC Laurent Pinchart, Dan Carpenter)

Right, I also cannot find that warn_alloc_failed() is called, during devm_kzalloc().

However, in the case of vmalloc(), warn_alloc_failed() is called as below.

./mm/vmalloc.c
vmalloc()
__vmalloc_node_flags()
__vmalloc_node()
__vmalloc_node_range()

./mm/page_alloc.c
warn_alloc_failed()

Quoted 2 lines

...

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I can see cases where NULL is returned after above paths and the function you mentioned wasn't there. So, I am not sure that we will get a print for sure for any error that might occur from devm_kzalloc().

I guess that slab_out_of_memory() <./mm/slub.c> may print it for any errors. But, I am not sure. :-(

devm_kzalloc() is just kmalloc(). The OOM error messages are the same.

Sure, but I wasn't sure whether all error code paths in kmalloc() resulted in an OOM message. For instance, the following code path results in an allocation failure but doesn't seem to print an OOM message:

kmalloc
__kmalloc
__do_kmalloc
slab_alloc
slab_should_failslab
should_failslab
should_fail

A bit far-fetched possibly as it requires fault injection. I haven't found any other such code path, but my understanding of that code is a bit limited.

Signature · 3 lines
Regards,

Laurent Pinchart
#17 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 58 lines · Laurent Pinchart

Hi Dan,

Quoted 34 lines · On Monday 03 March 2014 12:53:11 Dan Carpenter wrote:
Quoted 33 lines · Jingoo Han
Quoted 6 lines · Viresh Kumar
Quoted 1 line · Joe Perches

Look at warn_alloc_failed() in mm/page_alloc.c

Okay, there is a print there. But I am not able to reach to this routine from devm_kzalloc().

Quoted 6 lines

devm_kzalloc() <linux/device.h>
devm_kmalloc() <drivers/base/devres.c>
alloc_dr() <drivers/base/devres.c>
kmalloc_track_caller() <linux/slab.h> __kmalloc_track_caller() <mm/slab,slub/slob.c> Taking slab as example:
__do_kmalloc() <mm/slab.c>

(+CC Laurent Pinchart, Dan Carpenter)

Right, I also cannot find that warn_alloc_failed() is called, during devm_kzalloc().

However, in the case of vmalloc(), warn_alloc_failed() is called as below.

./mm/vmalloc.c
vmalloc()
__vmalloc_node_flags()
__vmalloc_node()
__vmalloc_node_range()

./mm/page_alloc.c
warn_alloc_failed()

Quoted 2 lines

...

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I can see cases where NULL is returned after above paths and the function you mentioned wasn't there. So, I am not sure that we will get a print for sure for any error that might occur from devm_kzalloc().

I guess that slab_out_of_memory() <./mm/slub.c> may print it for any errors. But, I am not sure. :-(

devm_kzalloc() is just kmalloc(). The OOM error messages are the same.

Sure, but I wasn't sure whether all error code paths in kmalloc() resulted in an OOM message. For instance, the following code path results in an allocation failure but doesn't seem to print an OOM message:

kmalloc
__kmalloc
__do_kmalloc
slab_alloc
slab_should_failslab
should_failslab
should_fail

Quoted 2 lines

A bit far-fetched possibly as it requires fault injection. I haven't found any other such code path, but my understanding of that code is a bit limited.

should_fail() only returns true after calling fail_dump().

You can pass (GFP_KERNEL | __GFP_NOWARN) if you want to turn off warnings. Otherwise it shuold print a warning.

regards,
dan carpenter

#18 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

In reply to Laurent Pinchart
Quoted 12 lines · Laurent Pinchart

Sure, but I wasn't sure whether all error code paths in kmalloc() resulted in an OOM message. For instance, the following code path results in an allocation failure but doesn't seem to print an OOM message:

kmalloc
__kmalloc
__do_kmalloc
slab_alloc
slab_should_failslab
should_failslab
should_fail

Quoted 2 lines

A bit far-fetched possibly as it requires fault injection. I haven't found any other such code path, but my understanding of that code is a bit limited.

In that case should we actually accept patches like this at all? As they might be ending up removing some useful print messages?

#19 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Hi Viresh,

Quoted 13 lines · On Thursday 06 March 2014 00:17:38 Viresh Kumar wrote:
Quoted 12 lines · Laurent Pinchart

Sure, but I wasn't sure whether all error code paths in kmalloc() resulted in an OOM message. For instance, the following code path results in an allocation failure but doesn't seem to print an OOM message:

kmalloc
__kmalloc
__do_kmalloc
slab_alloc
slab_should_failslab
should_failslab
should_fail

Quoted 6 lines
Quoted 3 lines

A bit far-fetched possibly as it requires fault injection. I haven't found any other such code path, but my understanding of that code is a bit limited.

In that case should we actually accept patches like this at all? As they might be ending up removing some useful print messages?

Dan has pointed out that I've missed the fail_dump() call in should_fail(). One could argue that fail_dump() wouldn't print any message if the fault injection framework has verbosity set to 0, but I suppose we can assume that people using the fault injection framework know what they're doing.

All other error paths in kmalloc() seem to result in a message being printed. I might have missed something, but I can trust the developers who know that code much better than I do that kmalloc() is designed to print an error message in all error paths. Any failure to print a message would be a kmalloc() bug that should be fixed, and getting rid of the allocation error messages in drivers would seem like a nice cleanup to me.

Signature · 3 lines
Regards,

Laurent Pinchart
author
#20 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 26 lines · Laurent Pinchart
Quoted 13 lines · On Thursday 06 March 2014 00:17:38 Viresh Kumar wrote:
Quoted 12 lines · Laurent Pinchart

Sure, but I wasn't sure whether all error code paths in kmalloc() resulted in an OOM message. For instance, the following code path results in an allocation failure but doesn't seem to print an OOM message:

kmalloc
__kmalloc
__do_kmalloc
slab_alloc
slab_should_failslab
should_failslab
should_fail

Quoted 6 lines
Quoted 3 lines

A bit far-fetched possibly as it requires fault injection. I haven't found any other such code path, but my understanding of that code is a bit limited.

In that case should we actually accept patches like this at all? As they might be ending up removing some useful print messages?

Dan has pointed out that I've missed the fail_dump() call in should_fail(). One could argue that fail_dump() wouldn't print any message if the fault injection framework has verbosity set to 0, but I suppose we can assume that people using the fault injection framework know what they're doing.

Quoted 6 lines

All other error paths in kmalloc() seem to result in a message being printed. I might have missed something, but I can trust the developers who know that code much better than I do that kmalloc() is designed to print an error message in all error paths. Any failure to print a message would be a kmalloc() bug that should be fixed, and getting rid of the allocation error messages in drivers would seem like a nice cleanup to me.

Hi Thierry Reding,

There seems to be no objection. :-)
Would you accept these patches?
Thank you.

Best regards,
Jingoo Han

#21 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 34 lines · Jingoo Han
Quoted 26 lines · Laurent Pinchart
Quoted 13 lines · On Thursday 06 March 2014 00:17:38 Viresh Kumar wrote:
Quoted 12 lines · Laurent Pinchart

Sure, but I wasn't sure whether all error code paths in kmalloc() resulted in an OOM message. For instance, the following code path results in an allocation failure but doesn't seem to print an OOM message:

kmalloc
__kmalloc
__do_kmalloc
slab_alloc
slab_should_failslab
should_failslab
should_fail

Quoted 6 lines
Quoted 3 lines

A bit far-fetched possibly as it requires fault injection. I haven't found any other such code path, but my understanding of that code is a bit limited.

In that case should we actually accept patches like this at all? As they might be ending up removing some useful print messages?

Dan has pointed out that I've missed the fail_dump() call in should_fail(). One could argue that fail_dump() wouldn't print any message if the fault injection framework has verbosity set to 0, but I suppose we can assume that people using the fault injection framework know what they're doing.

Quoted 6 lines

All other error paths in kmalloc() seem to result in a message being printed. I might have missed something, but I can trust the developers who know that code much better than I do that kmalloc() is designed to print an error message in all error paths. Any failure to print a message would be a kmalloc() bug that should be fixed, and getting rid of the allocation error messages in drivers would seem like a nice cleanup to me.

Quoted 5 lines

Hi Thierry Reding,

There seems to be no objection. :-)
Would you accept these patches?
Thank you.

All 9 patches applied, thanks.

Thierry

author
#22 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 1 line · Thierry Reding

On Fri, Mar 07, 2014 at 05:04:36PM +0900, Jingoo Han wrote:

[....]

Quoted 8 lines
Quoted 6 lines

Hi Thierry Reding,

There seems to be no objection. :-)
Would you accept these patches?
Thank you.

All 9 patches applied, thanks.

Hi Thierry,

I cannot find these patches from your pwm git tree. [1] Would you confirm it? :-) Thank you.

[1] http://git.kernel.org/cgit/linux/kernel/git/thierry.reding/linux-pwm.git/log/?h=for-next

Best regards,
Jingoo Han

Quoted 2 lines

Thierry

#23 lore raw

Re: [PATCH 5/9] pwm: spear: Remove unnecessary OOM messages

Quoted 12 lines · Jingoo Han
Quoted 1 line · Thierry Reding

On Fri, Mar 07, 2014 at 05:04:36PM +0900, Jingoo Han wrote:

[....]

Quoted 7 lines
Quoted 6 lines

Hi Thierry Reding,

There seems to be no objection. :-)
Would you accept these patches?
Thank you.

Quoted 8 lines
Quoted 1 line

All 9 patches applied, thanks.

Hi Thierry,

I cannot find these patches from your pwm git tree. [1] Would you confirm it? :-) Thank you.

[1] http://git.kernel.org/cgit/linux/kernel/git/thierry.reding/linux-pwm.git/log/?h=for-next

It seems like I never replied to this, but the patches have now been merged for a while.

Thierry

author
#24 lore raw

PATCH 6/9 pwm: tegra: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-tegra.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tegra.c +1 -3
index 74298c5..61d86b9 100644
@@ -173,10 +173,8 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 	int ret;
 
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
-	if (!pwm) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (!pwm)
 		return -ENOMEM;
-	}
 
 	pwm->dev = &pdev->dev;
 
Signature · 1 line
1.7.10.4
author
#25 lore raw

PATCH 7/9 pwm: pwm-tiecap: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-tiecap.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tiecap.c +1 -3
index 032092c..74efbe7 100644
@@ -209,10 +209,8 @@ static int ecap_pwm_probe(struct platform_device *pdev)
 	u16 status;
 
 	pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
-	if (!pc) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (!pc)
 		return -ENOMEM;
-	}
 
 	clk = devm_clk_get(&pdev->dev, "fck");
 	if (IS_ERR(clk)) {
Signature · 1 line
1.7.10.4
author
#26 lore raw

PATCH 8/9 pwm: tiehrpwm: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-tiehrpwm.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-tiehrpwm.c +1 -3
index aee4471..3a31c08 100644
@@ -440,10 +440,8 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
 	u16 status;
 
 	pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
-	if (!pc) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (!pc)
 		return -ENOMEM;
-	}
 
 	clk = devm_clk_get(&pdev->dev, "fck");
 	if (IS_ERR(clk)) {
Signature · 1 line
1.7.10.4
author
#27 lore raw

PATCH 9/9 pwm: vt8500: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/pwm/pwm-vt8500.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/pwm-vt8500.c +1 -3
index 323125a..652e6b5 100644
@@ -211,10 +211,8 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
 	}
 
 	chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
-	if (chip == NULL) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (chip == NULL)
 		return -ENOMEM;
-	}
 
 	chip->chip.dev = &pdev->dev;
 	chip->chip.ops = &vt8500_pwm_ops;
Signature · 1 line
1.7.10.4