Re: [PATCH v2 5/7] zram: support idle/huge page writeback

2018-11-26 Thread Joey Pabalinas
On Tue, Nov 27, 2018 at 11:13:27AM +0900, Minchan Kim wrote: > On Sun, Nov 25, 2018 at 11:47:37PM -1000, Joey Pabalinas wrote: > > On Mon, Nov 26, 2018 at 05:28:11PM +0900, Minchan Kim wrote: > > > + strlcpy(mode_buf, buf, sizeof(mode_buf)); > > > + /* ignore trailing newline */ > > > + sz = strlen

Re: [PATCH v2 5/7] zram: support idle/huge page writeback

2018-11-26 Thread Minchan Kim
On Sun, Nov 25, 2018 at 11:47:37PM -1000, Joey Pabalinas wrote: > On Mon, Nov 26, 2018 at 05:28:11PM +0900, Minchan Kim wrote: > > + strlcpy(mode_buf, buf, sizeof(mode_buf)); > > + /* ignore trailing newline */ > > + sz = strlen(mode_buf); > > One possible idea would be to use strscpy() inst

Re: [PATCH v2 5/7] zram: support idle/huge page writeback

2018-11-26 Thread Joey Pabalinas
On Sun, Nov 25, 2018 at 11:47:37PM -1000, Joey Pabalinas wrote: > > + if ((mode & IDLE_WRITEBACK && > > + !zram_test_flag(zram, index, ZRAM_IDLE)) && > > + (mode & HUGE_WRITEBACK && > > + !zram_test_flag(zram, index, ZRAM_HUGE))) > > +

Re: [PATCH v2 5/7] zram: support idle/huge page writeback

2018-11-26 Thread Joey Pabalinas
On Mon, Nov 26, 2018 at 05:28:11PM +0900, Minchan Kim wrote: > + strlcpy(mode_buf, buf, sizeof(mode_buf)); > + /* ignore trailing newline */ > + sz = strlen(mode_buf); One possible idea would be to use strscpy() instead and directly assign the return value to sz, avoiding an extra strl

[PATCH v2 5/7] zram: support idle/huge page writeback

2018-11-26 Thread Minchan Kim
This patch supports new feature "zram idle/huge page writeback". On zram-swap usecase, zram has usually many idle/huge swap pages. It's pointless to keep in memory(ie, zram). To solve the problem, this feature introduces idle/huge page writeback to backing device so the goal is to save more memory