lkml.org 
[lkml]   [2018]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 4/4] zram: introduce zram memory tracking
On (03/27/18 15:50), Minchan Kim wrote:
[..]
>
> + char flags[__NR_ZRAM_PAGEFLAGS - ZRAM_FLAG_SHIFT];
>

Technically, you don't need this buffer...

> + snprintf(flags, sizeof(flags), "%c%c%c",
> + zram_test_flag(zram, index, ZRAM_SAME) ? 's' : '.',
> + zram_test_flag(zram, index, ZRAM_WB) ? 'w' : '.',
> + zram_test_flag(zram, index, ZRAM_HUGE) ? 'h' : '.');
> +
> + last_access = get_seconds() - zram->table[index].ac_time;
> + copied = snprintf(kbuf + written, count, "%12lu %6s %12lu\n",
> + index, flags, last_access);

... if you'll do flags decoding in place. But if you prefer it this way
then OK.

-ss

\
 
 \ /
  Last update: 2018-03-27 10:11    [W:0.084 / U:0.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site