2014-11-12 14:37:30

by Ganesh Mahendran

[permalink] [raw]
Subject: [PATCH] mm/zram: correct ZRAM_ZERO flag bit position

In struct zram_table_entry, the element *value* contains obj size and
obj zram flags. Bit 0 to bit (ZRAM_FLAG_SHIFT - 1) represent obj size,
and bit ZRAM_FLAG_SHIFT to the highest bit of unsigned long represent obj
zram_flags. So the first zram flag(ZRAM_ZERO) should be from ZRAM_FLAG_SHIFT
instead of (ZRAM_FLAG_SHIFT + 1).

This patch fixes this issue.

Also this patch fixes a typo, "page in now accessed" -> "page is now accessed"

Signed-off-by: Mahendran Ganesh <[email protected]>
---
drivers/block/zram/zram_drv.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
index c6ee271..b05a816 100644
--- a/drivers/block/zram/zram_drv.h
+++ b/drivers/block/zram/zram_drv.h
@@ -66,8 +66,8 @@ static const size_t max_zpage_size = PAGE_SIZE / 4 * 3;
/* Flags for zram pages (table[page_no].value) */
enum zram_pageflags {
/* Page consists entirely of zeros */
- ZRAM_ZERO = ZRAM_FLAG_SHIFT + 1,
- ZRAM_ACCESS, /* page in now accessed */
+ ZRAM_ZERO = ZRAM_FLAG_SHIFT,
+ ZRAM_ACCESS, /* page is now accessed */

__NR_ZRAM_PAGEFLAGS,
};
--
1.7.9.5


2014-11-13 00:02:10

by Minchan Kim

[permalink] [raw]
Subject: Re: [PATCH] mm/zram: correct ZRAM_ZERO flag bit position

On Wed, Nov 12, 2014 at 10:37:18PM +0800, Mahendran Ganesh wrote:
> In struct zram_table_entry, the element *value* contains obj size and
> obj zram flags. Bit 0 to bit (ZRAM_FLAG_SHIFT - 1) represent obj size,
> and bit ZRAM_FLAG_SHIFT to the highest bit of unsigned long represent obj
> zram_flags. So the first zram flag(ZRAM_ZERO) should be from ZRAM_FLAG_SHIFT
> instead of (ZRAM_FLAG_SHIFT + 1).
>
> This patch fixes this issue.
>
> Also this patch fixes a typo, "page in now accessed" -> "page is now accessed"
>
> Signed-off-by: Mahendran Ganesh <[email protected]>
Acked-by: Minchan Kim <[email protected]>

To be clear about "fixes this issue", it's not a bug but just clean up
so it doesn't change any behavior.

Thanks!

--
Kind regards,
Minchan Kim

2014-11-13 01:28:45

by Weijie Yang

[permalink] [raw]
Subject: RE: [PATCH] mm/zram: correct ZRAM_ZERO flag bit position

On Thu, Nov 13, 2014 at 8:02 AM, Minchan Kim <[email protected]> wrote:
> On Wed, Nov 12, 2014 at 10:37:18PM +0800, Mahendran Ganesh wrote:
>> In struct zram_table_entry, the element *value* contains obj size and
>> obj zram flags. Bit 0 to bit (ZRAM_FLAG_SHIFT - 1) represent obj size,
>> and bit ZRAM_FLAG_SHIFT to the highest bit of unsigned long represent obj
>> zram_flags. So the first zram flag(ZRAM_ZERO) should be from ZRAM_FLAG_SHIFT
>> instead of (ZRAM_FLAG_SHIFT + 1).
>>
>> This patch fixes this issue.
>>
>> Also this patch fixes a typo, "page in now accessed" -> "page is now accessed"
>>
>> Signed-off-by: Mahendran Ganesh <[email protected]>
> Acked-by: Minchan Kim <[email protected]>

Acked-by: Weijie Yang <[email protected]>

> To be clear about "fixes this issue", it's not a bug but just clean up
> so it doesn't change any behavior.
>
> Thanks!
>
> --
> Kind regards,
> Minchan Kim
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2014-11-13 13:54:21

by Ganesh Mahendran

[permalink] [raw]
Subject: Re: [PATCH] mm/zram: correct ZRAM_ZERO flag bit position

2014-11-13 8:02 GMT+08:00 Minchan Kim <[email protected]>:
> On Wed, Nov 12, 2014 at 10:37:18PM +0800, Mahendran Ganesh wrote:
>> In struct zram_table_entry, the element *value* contains obj size and
>> obj zram flags. Bit 0 to bit (ZRAM_FLAG_SHIFT - 1) represent obj size,
>> and bit ZRAM_FLAG_SHIFT to the highest bit of unsigned long represent obj
>> zram_flags. So the first zram flag(ZRAM_ZERO) should be from ZRAM_FLAG_SHIFT
>> instead of (ZRAM_FLAG_SHIFT + 1).
>>
>> This patch fixes this issue.
>>
>> Also this patch fixes a typo, "page in now accessed" -> "page is now accessed"
>>
>> Signed-off-by: Mahendran Ganesh <[email protected]>
> Acked-by: Minchan Kim <[email protected]>

Thanks!

>
> To be clear about "fixes this issue", it's not a bug but just clean up
> so it doesn't change any behavior.
>
> Thanks!
>
> --
> Kind regards,
> Minchan Kim

2014-11-13 13:54:51

by Ganesh Mahendran

[permalink] [raw]
Subject: Re: [PATCH] mm/zram: correct ZRAM_ZERO flag bit position

2014-11-13 9:27 GMT+08:00 Weijie Yang <[email protected]>:
> On Thu, Nov 13, 2014 at 8:02 AM, Minchan Kim <[email protected]> wrote:
>> On Wed, Nov 12, 2014 at 10:37:18PM +0800, Mahendran Ganesh wrote:
>>> In struct zram_table_entry, the element *value* contains obj size and
>>> obj zram flags. Bit 0 to bit (ZRAM_FLAG_SHIFT - 1) represent obj size,
>>> and bit ZRAM_FLAG_SHIFT to the highest bit of unsigned long represent obj
>>> zram_flags. So the first zram flag(ZRAM_ZERO) should be from ZRAM_FLAG_SHIFT
>>> instead of (ZRAM_FLAG_SHIFT + 1).
>>>
>>> This patch fixes this issue.
>>>
>>> Also this patch fixes a typo, "page in now accessed" -> "page is now accessed"
>>>
>>> Signed-off-by: Mahendran Ganesh <[email protected]>
>> Acked-by: Minchan Kim <[email protected]>
>
> Acked-by: Weijie Yang <[email protected]>

Thanks

>
>> To be clear about "fixes this issue", it's not a bug but just clean up
>> so it doesn't change any behavior.
>>
>> Thanks!
>>
>> --
>> Kind regards,
>> Minchan Kim
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>
>

2014-11-13 14:55:17

by Sergey Senozhatsky

[permalink] [raw]
Subject: Re: [PATCH] mm/zram: correct ZRAM_ZERO flag bit position

On (11/12/14 22:37), Mahendran Ganesh wrote:
> In struct zram_table_entry, the element *value* contains obj size and
> obj zram flags. Bit 0 to bit (ZRAM_FLAG_SHIFT - 1) represent obj size,
> and bit ZRAM_FLAG_SHIFT to the highest bit of unsigned long represent obj
> zram_flags. So the first zram flag(ZRAM_ZERO) should be from ZRAM_FLAG_SHIFT
> instead of (ZRAM_FLAG_SHIFT + 1).
>
> This patch fixes this issue.

well, I wouldn't say this is an issue; but still.

Acked-by: Sergey Senozhatsky <[email protected]>

-ss

> Also this patch fixes a typo, "page in now accessed" -> "page is now accessed"
>
> Signed-off-by: Mahendran Ganesh <[email protected]>
> ---
> drivers/block/zram/zram_drv.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
> index c6ee271..b05a816 100644
> --- a/drivers/block/zram/zram_drv.h
> +++ b/drivers/block/zram/zram_drv.h
> @@ -66,8 +66,8 @@ static const size_t max_zpage_size = PAGE_SIZE / 4 * 3;
> /* Flags for zram pages (table[page_no].value) */
> enum zram_pageflags {
> /* Page consists entirely of zeros */
> - ZRAM_ZERO = ZRAM_FLAG_SHIFT + 1,
> - ZRAM_ACCESS, /* page in now accessed */
> + ZRAM_ZERO = ZRAM_FLAG_SHIFT,
> + ZRAM_ACCESS, /* page is now accessed */
>
> __NR_ZRAM_PAGEFLAGS,
> };
> --
> 1.7.9.5
>