[PATCH] Staging: hv: fix sleeping while atomic issue

Greg KH gregkh at suse.de
Fri Dec 10 17:35:19 UTC 2010


On Fri, Dec 10, 2010 at 05:00:01PM +0200, Timo Teräs wrote:
> osd_schedule_callback() is called from VmbusOnMsgDPC() which runs
> in a tasklet. Avoid possible sleeping by using GFP_ATOMIC for the
> memory allocation.
> 
> Seems to fix #16701.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16701
> Cc: Haiyang Zhang <haiyangz at microsoft.com>
> Cc: Hank Janssen <hjanssen at microsoft.com>
> Signed-off-by: Timo Teräs <timo.teras at iki.fi>
> ---
>  drivers/staging/hv/osd.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c
> index 8c3eb27..eb9b20d 100644
> --- a/drivers/staging/hv/osd.c
> +++ b/drivers/staging/hv/osd.c
> @@ -214,7 +214,7 @@ int osd_schedule_callback(struct workqueue_struct *wq,
>  {
>  	struct osd_callback_struct *cb;
>  
> -	cb = kmalloc(sizeof(*cb), GFP_KERNEL);
> +	cb = kmalloc(sizeof(*cb), GFP_ATOMIC);

How about just fixing the one place where this is needed?  You don't
need this for all of the osd_schedule_callback() functions, right?

Actually, we should unroll this function entirely and use the "real"
functions the kernel provides us.  I'd much rather see that fix than
this one which just papers over the problem.

thanks,

greg k-h



More information about the devel mailing list