linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Richard Chang <richardycc@google.com>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Brian Geffon <bgeffon@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zram: modernize writeback interface
Date: Wed, 26 Mar 2025 15:07:43 +0800	[thread overview]
Message-ID: <CALC_0q9hRAX=46Zd+qh5Pq1myXx+=9gSTT5hu7t1s_Ko4xd_Og@mail.gmail.com> (raw)
In-Reply-To: <5l4pjqlgu4afndn3ysa7ynecjmvepkfjlh56ycm5jt5e4mioqm@dujakwaomhlk>

Hi Sergey,

On Wed, Mar 26, 2025 at 12:16 PM Sergey Senozhatsky
<senozhatsky@chromium.org> wrote:
>
> Hi,
>
> On (25/03/26 12:03), Richard Chang wrote:
> > Hi Sergey,
> > Since the input buffer length is only PAGE_SIZE long, can we reduce
> > the duplicated "page_index_range=" strings?
> > Eg:
> > Turn
> > echo page_index_range=100-200 \
> >          page_index_range=500-700 > zram0/writeback
> > To:
> > echo page_index_range=100-200,500-700 > zram0/writeback
>
> Do you expect to ever have so many ranges that PAGE_SIZE buffer
> would be too small?  I didn't want to put a list parser into
> the kernel, I wanted to keep arguments parsing as simple as
> possible.  But if you really need to writeback that many pages
> then I guess I can implement it as a list of ranges.
>
> Alternatively:
> We don't necessarily need to use page_index_range key, which is a
> little long, but can use page_indices=/page_indexes= or just pages=?

I am just counting how many pages we could writeback per syscall.
In a worst case, page_index_range with several two-adjacent indices:
Assume PAGE_SIZE is 4k and index range is around 10000,

page_index_range allows 272 pages per syscall:
page_index_range=10000-10001 page_index_range=10003-10004...

List_range allows 678 pages per syscall:
page_index_range=10000-10001,10003-10004...

page_indices allows 314 pages per syscall:
page_indices=10000-10001 page_indices=10003-10004...

It's the worst case so the actual world might not be that bad.

Another alternative thought, how about page_index supporting both
single instance and ranges?
The key is shorter and the parser is relatively simpler.
Eg: page_index=500 page_index=10000-10001


  reply	other threads:[~2025-03-26  7:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25  3:42 Sergey Senozhatsky
2025-03-25 21:52 ` Minchan Kim
2025-03-26  4:03   ` Richard Chang
2025-03-26  4:16     ` Sergey Senozhatsky
2025-03-26  7:07       ` Richard Chang [this message]
2025-03-26  8:15         ` Sergey Senozhatsky
2025-03-26  8:45           ` Sergey Senozhatsky
2025-03-26  9:31             ` Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALC_0q9hRAX=46Zd+qh5Pq1myXx+=9gSTT5hu7t1s_Ko4xd_Og@mail.gmail.com' \
    --to=richardycc@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=bgeffon@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox