public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc()
@ 2013-12-11 14:54 Ethan Zhao
  2014-01-05  2:05 ` David Miller
  2014-01-07  2:21 ` Ethan Zhao
  0 siblings, 2 replies; 7+ messages in thread
From: Ethan Zhao @ 2013-12-11 14:54 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel, Ethan Zhao

Has kmalloc() failure checking there, so it is unnecessary to allocate with
__GFP_NOFAIL flag that might block forever.

Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
---
 arch/sparc/kernel/mdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index b90bf23..e8d678c 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -136,7 +136,7 @@ static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size)
 		       sizeof(struct mdesc_hdr) +
 		       mdesc_size);
 
-	base = kmalloc(handle_size + 15, GFP_KERNEL | __GFP_NOFAIL);
+	base = kmalloc(handle_size + 15, GFP_KERNEL | GFP_ATOMIC);
 	if (base) {
 		struct mdesc_handle *hp;
 		unsigned long addr;
-- 
1.8.3.4 (Apple Git-47)


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc()
  2013-12-11 14:54 [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc() Ethan Zhao
@ 2014-01-05  2:05 ` David Miller
  2014-01-07  1:48   ` Ethan Zhao
  2014-01-07  2:21 ` Ethan Zhao
  1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2014-01-05  2:05 UTC (permalink / raw)
  To: ethan.kernel; +Cc: linux-kernel

From: Ethan Zhao <ethan.kernel@gmail.com>
Date: Wed, 11 Dec 2013 22:54:21 +0800

> Has kmalloc() failure checking there, so it is unnecessary to allocate with
> __GFP_NOFAIL flag that might block forever.
> 
> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>

Please submit sparc patches with sparclinux@vger.kernel.org at least
CC:'d.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc()
  2014-01-05  2:05 ` David Miller
@ 2014-01-07  1:48   ` Ethan Zhao
  0 siblings, 0 replies; 7+ messages in thread
From: Ethan Zhao @ 2014-01-07  1:48 UTC (permalink / raw)
  To: David Miller; +Cc: LKML

David,
   Got it. thanks,


Ethan

On Sun, Jan 5, 2014 at 10:05 AM, David Miller <davem@davemloft.net> wrote:
> From: Ethan Zhao <ethan.kernel@gmail.com>
> Date: Wed, 11 Dec 2013 22:54:21 +0800
>
>> Has kmalloc() failure checking there, so it is unnecessary to allocate with
>> __GFP_NOFAIL flag that might block forever.
>>
>> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
>
> Please submit sparc patches with sparclinux@vger.kernel.org at least
> CC:'d.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc()
  2013-12-11 14:54 [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc() Ethan Zhao
  2014-01-05  2:05 ` David Miller
@ 2014-01-07  2:21 ` Ethan Zhao
  2014-01-07  2:29   ` David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: Ethan Zhao @ 2014-01-07  2:21 UTC (permalink / raw)
  To: David Miller; +Cc: LKML, sparclinux

cc sparclinux@vger.kernel.org

On Wed, Dec 11, 2013 at 10:54 PM, Ethan Zhao <ethan.kernel@gmail.com> wrote:
> Has kmalloc() failure checking there, so it is unnecessary to allocate with
> __GFP_NOFAIL flag that might block forever.
>
> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
> ---
>  arch/sparc/kernel/mdesc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
> index b90bf23..e8d678c 100644
> --- a/arch/sparc/kernel/mdesc.c
> +++ b/arch/sparc/kernel/mdesc.c
> @@ -136,7 +136,7 @@ static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size)
>                        sizeof(struct mdesc_hdr) +
>                        mdesc_size);
>
> -       base = kmalloc(handle_size + 15, GFP_KERNEL | __GFP_NOFAIL);
> +       base = kmalloc(handle_size + 15, GFP_KERNEL | GFP_ATOMIC);
>         if (base) {
>                 struct mdesc_handle *hp;
>                 unsigned long addr;
> --
> 1.8.3.4 (Apple Git-47)
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc()
  2014-01-07  2:21 ` Ethan Zhao
@ 2014-01-07  2:29   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2014-01-07  2:29 UTC (permalink / raw)
  To: ethan.kernel; +Cc: linux-kernel, sparclinux

From: Ethan Zhao <ethan.kernel@gmail.com>
Date: Tue, 7 Jan 2014 10:21:51 +0800

> cc sparclinux@vger.kernel.org

Please make a fresh patch posting with sparclinux included so that
your patch gets properly queued up and tracked in patchwork:

http://patchwork.ozlabs.org/project/sparclinux/list/

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc()
@ 2014-01-07  9:31 Ethan Zhao
  2014-01-07 19:11 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Ethan Zhao @ 2014-01-07  9:31 UTC (permalink / raw)
  To: davem; +Cc: sparclinux, linux-kernel, Ethan Zhao

Has kmalloc() failure checking there, so it is unnecessary to allocate with
__GFP_NOFAIL flag that might block forever.

Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
---
 arch/sparc/kernel/mdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index b90bf23..e8d678c 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -136,7 +136,7 @@ static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size)
 		       sizeof(struct mdesc_hdr) +
 		       mdesc_size);
 
-	base = kmalloc(handle_size + 15, GFP_KERNEL | __GFP_NOFAIL);
+	base = kmalloc(handle_size + 15, GFP_KERNEL | GFP_ATOMIC);
 	if (base) {
 		struct mdesc_handle *hp;
 		unsigned long addr;
-- 
1.8.3.4 (Apple Git-47)


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc()
  2014-01-07  9:31 Ethan Zhao
@ 2014-01-07 19:11 ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2014-01-07 19:11 UTC (permalink / raw)
  To: ethan.kernel; +Cc: sparclinux, linux-kernel

From: Ethan Zhao <ethan.kernel@gmail.com>
Date: Tue,  7 Jan 2014 17:31:17 +0800

> Has kmalloc() failure checking there, so it is unnecessary to allocate with
> __GFP_NOFAIL flag that might block forever.
> 
> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>

This allocation failing borders on catastrophic.  The allocation failure
handling is just for looks.

This function is triggered when the firmware tells us that new cpus or
other devices are available.  This memory being allocated will hold
the machine description that we traverse to find those new devices.

If this allocation is allowed to fail, we will never have any way to
get the notification again.  It really is __GFP_NOFAIL and must
succeed.

I'm not applying this, sorry.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-01-07 19:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11 14:54 [PATCH] sparc: replace __GFP_NOFAIL with GFP_ATOMIC in mdesc_kmalloc() Ethan Zhao
2014-01-05  2:05 ` David Miller
2014-01-07  1:48   ` Ethan Zhao
2014-01-07  2:21 ` Ethan Zhao
2014-01-07  2:29   ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2014-01-07  9:31 Ethan Zhao
2014-01-07 19:11 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox