[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bcf7bc51-1689-fec5-f167-14fb46409b76@huawei.com>
Date: Thu, 28 Jun 2018 17:40:36 +0800
From: Gao Xiang <gaoxiang25@...wei.com>
To: Matthew Wilcox <willy@...radead.org>
CC: <viro@...iv.linux.org.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kate Stewart <kstewart@...uxfoundation.org>,
Philippe Ombredanne <pombredanne@...b.com>,
Thomas Gleixner <tglx@...utronix.de>,
Chao Yu <yuchao0@...wei.com>, Miao Xie <miaoxie@...wei.com>,
<linux-fsdevel@...r.kernel.org>, <linux-erofs@...ts.ozlabs.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] <linux/taggedptr.h>: Introduce tagged pointer
Hi Matthew,
On 2018/6/28 17:23, Matthew Wilcox wrote:
> On Thu, Jun 28, 2018 at 05:06:29PM +0800, Gao Xiang wrote:
>> Therefore, this patch introduces simple generic methods to fold
>> tags into a pointer integer. It currently reuses the last 2 bits
>> of the pointer for tags, which are safely for all modern platforms.
>
> The m68k people will have your head. alignof(unsigned long) == 2 on
> m68k. Now, kmalloc always returns 8-byte aligned quantities, but
> if you have:
>
> static unsigned long foo;
>
> then ((unsigned long)&foo & 2) may be non-zero.
>
Oh.. I missed it. How about covering dynamic allocation scenario only?
(since 1 bit is too limited to be used for generic purposes... :( )
Or generate different bit mask versions by using macro? --- I could try in the next patch.
Anyway, I think it is depended on specific use cases and corresponding architectures...
>> +/*
>> + * mark these special integers as another type
>> + * in order to highlight the tagged pointer usage.
>> + */
>> +typedef uintptr_t taggedptr_t;
>
> I find this a bit verbose. How about tagptr_t ?
>
Boths are ok for me :)
Thanks,
Gao Xiang
Powered by blists - more mailing lists