On Mon, Mar 09, 2015 at 10:27:28AM +0900, Sergey Senozhatsky wrote: > On (03/09/15 10:05), Minchan Kim wrote: > > > well, to be fair, compaction is a zsmalloc internal. zram has nothing to > > > do with > > > it. > > > > > > but do we we even need this stat? it seems that > > > > > > mem_total_used (before compaction) - mem_total_user (after comapction) > > > > > > will give user an idea on how much memory was compacted. > > > > It's not enough. What I want to know is compaction efficiency per client of > > zsmalloc(ie, zram). > > > > so what a typical user can do with this information? isn't it an entirely > debug info that makes some hidden sense only to developers?
Absolutely true. > > if you insist on exporting this as a zram stat for everyone how obout > starting to move away from per-stat RO sysfs attrs. it seems that we have > uncomfortably a lot of sysfs attrs, and that doesn't make life easier in > user space. for example, block devices have /sys/block/.../stat file: > > /sys/block/sda$ cat stat > 45931 59 2075686 289906 55768 9229 1967800 318033 > 0 193583 607806 > > and there are no num_reads, num_writes, num_failed_reads, num_failed_writes, > etc., etc. per-stat sysfs attrs force user-space to do lots of syscalls: > open(), read(), close() with error control on every step; for every stat. I absoulte agree with you and I really wanted to tidy it up but was no time. Sergey, Could you contribute? If you have no time, I will do by myself but it would be low priority now. > > so how about introducing zram<id>/malloc_stats (or any similar name) and > provide compaction and all future allocator related stats there > (via s*printf("%d %d %d", ....)) ? > > -ss > > > IOW, (how many of freed pages / how many of objects) per > > zs_compact. > > > > > > > > -ss > > > > > > > That's why it is on debugfs. If we add the stat into zsmalloc, we > > > > should turn on debugfs > > > > and CONFIG_ZSMALLOC_STAT to see *a* stat. Even, CONFIG_ZSMALLOC_STAT > > > > will add > > > > unncessary overheads to account another stats fo zsmalloc internals. > > > > > > > > As well, if we add auto-compacion like stuff in zsmalloc(ie, it will > > > > trigger > > > > by itself if fragmention is over to predefined theshold), the stat will > > > > accumulate stat while someone want to see snapshot compaction effiecieny > > > > of the moment. > > > > > > > > So, I want to keep it in zram now. > > > > > > > > -- > > > > Kind regards, > > > > Minchan Kim > > > > > > > > -- > > Kind regards, > > Minchan Kim > > -- Kind regards, Minchan Kim -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/