public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	Peng Tao <tao.peng@emc.com>
Subject: Re: [PATCH] staging: lustre: fix GFP_ATOMIC macro usage
Date: Fri, 17 Jan 2014 06:33:29 -0800	[thread overview]
Message-ID: <20140117143329.GA6877@kroah.com> (raw)
In-Reply-To: <1389948416-26390-1-git-send-email-m.szyprowski@samsung.com>

On Fri, Jan 17, 2014 at 09:46:56AM +0100, Marek Szyprowski wrote:
> GFP_ATOMIC is not a single gfp flag, but a macro which expands to the other
> flags and LACK of __GFP_WAIT flag. To check if caller wanted to perform an
> atomic allocation, the code must test __GFP_WAIT flag presence.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  .../lustre/include/linux/libcfs/libcfs_private.h   |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
> index d0d942c..dddccca1 100644
> --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
> +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
> @@ -120,7 +120,7 @@ do {						\
>  do {									    \
>  	LASSERT(!in_interrupt() ||					    \
>  		((size) <= LIBCFS_VMALLOC_SIZE &&			    \
> -		 ((mask) & GFP_ATOMIC)) != 0);			    \
> +		 ((mask) & __GFP_WAIT) == 0));				    \
>  } while (0)

What a horrible assert, can't we just remove this entirely?
in_interrupt() usually should never be checked, if so, the code is doing
something wrong.  And __GFP flags shouldn't be used on their own.

thanks,

greg k-h

  reply	other threads:[~2014-01-17 14:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17  8:46 [PATCH] staging: lustre: fix GFP_ATOMIC macro usage Marek Szyprowski
2014-01-17 14:33 ` Greg Kroah-Hartman [this message]
2014-01-17 14:51   ` Dan Carpenter
2014-01-17 15:17     ` Greg Kroah-Hartman
2014-01-21 20:02       ` Dilger, Andreas
2014-01-21 20:16         ` Dan Carpenter
2014-01-22  1:31           ` Drokin, Oleg
2014-01-21 21:15         ` Dave Hansen
2014-01-22  1:52           ` Drokin, Oleg
2014-01-20  8:18   ` Marek Szyprowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140117143329.GA6877@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=tao.peng@emc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox