mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-kernel@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH v2 3/3] slab: use logical instead of bitwise operation in kmalloc_type()
Date: Fri, 9 Nov 2018 10:53:14 -0800	[thread overview]
Message-ID: <20181109105314.c6a6acfa9badba6733c3f72e@linux-foundation.org> (raw)
In-Reply-To: <20181109093534.15121-3-johannes@sipsolutions.net>

On Fri,  9 Nov 2018 10:35:34 +0100 Johannes Berg <johannes@sipsolutions.net> wrote:

> The operation here really is more logical than bitwise, even if
> due to the setup the bitwise operation works fine. However, this
> causes a complaint from sparse that the operation doesn't really
> make sense due to the not.
> 
> Use a logical and instead of bitwise.
> 
> In my (somewhat unscientific) test this caused no differences in
> the generated code.
> 
> ...
>
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -329,7 +329,7 @@ static __always_inline enum kmalloc_cache_type kmalloc_type(gfp_t flags)
>  	 * If an allocation is both __GFP_DMA and __GFP_RECLAIMABLE, return
>  	 * KMALLOC_DMA and effectively ignore __GFP_RECLAIMABLE
>  	 */
> -	return type_dma + (is_reclaimable & !is_dma) * KMALLOC_RECLAIM;
> +	return type_dma + (is_reclaimable && !is_dma) * KMALLOC_RECLAIM;
>  }
>  
>  /*

Thanks.  There's presently a bit of head-scratching going on over this.
http://lkml.kernel.org/r/20181105204000.129023-1-bvanassche@acm.org -
please feel free to weigh in ;)


  reply	other threads:[~2018-11-09 18:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  9:35 [PATCH v2 1/3] compiler-gcc: hide COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW from sparse Johannes Berg
2018-11-09  9:35 ` [PATCH v2 2/3] kernel.h: hide __is_constexpr() " Johannes Berg
2018-11-17  0:45   ` Luc Van Oostenryck
2018-11-09  9:35 ` [PATCH v2 3/3] slab: use logical instead of bitwise operation in kmalloc_type() Johannes Berg
2018-11-09 18:53   ` Andrew Morton [this message]
2018-11-17  0:42 ` [PATCH v2 1/3] compiler-gcc: hide COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW from sparse Luc Van Oostenryck
2018-11-17 11:29   ` Johannes Berg

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=20181109105314.c6a6acfa9badba6733c3f72e@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®