LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: unisys: visornic: Replace GFP_ATOMIC with GFP_KERNEL
@ 2019-05-22 17:05 Hariprasad Kelam
  2019-05-23  7:17 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Hariprasad Kelam @ 2019-05-22 17:05 UTC (permalink / raw)
  To: David Kershner, Greg Kroah-Hartman, Petr Machata, David Ahern,
	David S. Miller, Jann Horn, Hariprasad Kelam, sparmaintainer,
	devel, linux-kernel

As per below information

GFP_KERNEL  FLAG

This is a normal allocation and might block. This is the flag to use in
process context code when it is safe to sleep.

GFP_ATOMIC FLAG

The allocation is high-priority and does not sleep. This is the flag to
use in interrupt handlers, bottom halves and other situations where you
cannot sleep

And we can take advantage of GFP_KERNEL , as when system is in low
memory chances of getting success is high compared to GFP_ATOMIC.

As visornic_probe is in  process context we can use GPF_KERNEL.

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 1c1a470..9d4f1da 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1861,12 +1861,12 @@ static int visornic_probe(struct visor_device *dev)
 	skb_queue_head_init(&devdata->xmitbufhead);
 
 	/* create a cmdrsp we can use to post and unpost rcv buffers */
-	devdata->cmdrsp_rcv = kmalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
+	devdata->cmdrsp_rcv = kmalloc(SIZEOF_CMDRSP, GFP_KERNEL);
 	if (!devdata->cmdrsp_rcv) {
 		err = -ENOMEM;
 		goto cleanup_rcvbuf;
 	}
-	devdata->xmit_cmdrsp = kmalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
+	devdata->xmit_cmdrsp = kmalloc(SIZEOF_CMDRSP, GFP_KERNEL);
 	if (!devdata->xmit_cmdrsp) {
 		err = -ENOMEM;
 		goto cleanup_cmdrsp_rcv;
-- 
2.7.4


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

* Re: [PATCH] staging: unisys: visornic: Replace GFP_ATOMIC with GFP_KERNEL
  2019-05-22 17:05 [PATCH] staging: unisys: visornic: Replace GFP_ATOMIC with GFP_KERNEL Hariprasad Kelam
@ 2019-05-23  7:17 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2019-05-23  7:17 UTC (permalink / raw)
  To: Hariprasad Kelam
  Cc: David Kershner, Petr Machata, David Ahern, David S. Miller,
	Jann Horn, sparmaintainer, devel, linux-kernel

On Wed, May 22, 2019 at 10:35:30PM +0530, Hariprasad Kelam wrote:
> As per below information
> 
> GFP_KERNEL  FLAG
> 
> This is a normal allocation and might block. This is the flag to use in
> process context code when it is safe to sleep.
> 
> GFP_ATOMIC FLAG
> 
> The allocation is high-priority and does not sleep. This is the flag to
> use in interrupt handlers, bottom halves and other situations where you
> cannot sleep
> 
> And we can take advantage of GFP_KERNEL , as when system is in low
> memory chances of getting success is high compared to GFP_ATOMIC.
> 
> As visornic_probe is in  process context we can use GPF_KERNEL.

Ah, nice catch!  Will go queue this up now, thanks.

greg k-h

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

end of thread, other threads:[~2019-05-23  7:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 17:05 [PATCH] staging: unisys: visornic: Replace GFP_ATOMIC with GFP_KERNEL Hariprasad Kelam
2019-05-23  7:17 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).