From: Dan Williams <dan.j.williams@intel.com>
To: Jan Kara <jack@suse.cz>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
Linux MM <linux-mm@kvack.org>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] mm: Handle 0 flags in _calc_vm_trans() macro
Date: Fri, 3 Nov 2017 06:31:19 -0700 [thread overview]
Message-ID: <CAPcyv4jkf4b=xoNVNxt2x7_MmXAprunMHGt02=ue602atJt-Pw@mail.gmail.com> (raw)
In-Reply-To: <20171103112121.23597-1-jack@suse.cz>
On Fri, Nov 3, 2017 at 4:21 AM, Jan Kara <jack@suse.cz> wrote:
> _calc_vm_trans() does not handle the situation when some of the passed
> flags are 0 (which can happen if these VM flags do not make sense for
> the architecture). Improve the _calc_vm_trans() macro to return 0 in
> such situation. Since all passed flags are constant, this does not add
> any runtime overhead.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> include/linux/mman.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Dan, can you please prepend this patch before my series so that we don't
> break bisectability? This fixes the reported problem for me when arch
> does not define MAP_SYNC. Thanks!
>
> diff --git a/include/linux/mman.h b/include/linux/mman.h
> index 8f7cc87828e6..3427bf3daef5 100644
> --- a/include/linux/mman.h
> +++ b/include/linux/mman.h
> @@ -105,8 +105,9 @@ static inline bool arch_validate_prot(unsigned long prot)
> * ("bit1" and "bit2" must be single bits)
> */
> #define _calc_vm_trans(x, bit1, bit2) \
> + ((!(bit1) || !(bit2)) ? 0 : \
> ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \
> - : ((x) & (bit1)) / ((bit1) / (bit2)))
> + : ((x) & (bit1)) / ((bit1) / (bit2))))
>
Looks good to me, thanks Jan.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2017-11-03 13:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 11:21 Jan Kara
2017-11-03 13:31 ` Dan Williams [this message]
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='CAPcyv4jkf4b=xoNVNxt2x7_MmXAprunMHGt02=ue602atJt-Pw@mail.gmail.com' \
--to=dan.j.williams@intel.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-mm@kvack.org \
--cc=ross.zwisler@linux.intel.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