linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: John Stultz <john.stultz@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Android Kernel Team <kernel-team@android.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Robert Love <rlove@google.com>, Mel Gorman <mel@csn.ul.ie>,
	Hugh Dickins <hughd@google.com>, Dave Hansen <dave@sr71.net>,
	Rik van Riel <riel@redhat.com>,
	Dmitry Adamushko <dmitry.adamushko@gmail.com>,
	Neil Brown <neilb@suse.de>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Mike Hommey <mh@glandium.org>, Taras Glek <tglek@mozilla.com>,
	KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	Michel Lespinasse <walken@google.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH 0/3] Volatile Ranges (v11)
Date: Fri, 21 Mar 2014 14:29:36 +0900	[thread overview]
Message-ID: <20140321052936.GB7450@bbox> (raw)
In-Reply-To: <20140320081359.GB32080@quack.suse.cz>

On Thu, Mar 20, 2014 at 09:13:59AM +0100, Jan Kara wrote:
> On Thu 20-03-14 10:09:54, Minchan Kim wrote:
> > Hello,
> > 
> > On Wed, Mar 19, 2014 at 11:12:02AM +0100, Jan Kara wrote:
> > > On Wed 19-03-14 09:49:18, Minchan Kim wrote:
> > > > On Tue, Mar 18, 2014 at 11:07:50AM -0700, John Stultz wrote:
> > > > > On Tue, Mar 18, 2014 at 8:11 AM, Minchan Kim <minchan@kernel.org> wrote:
> > > > > > 1) SIGBUS
> > > > > >
> > > > > > It's one of the arguable issue because some user want to get a
> > > > > > SIGBUS(ex, Firefox) while other want a just zero page(ex, Google
> > > > > > address sanitizer) without signal so it should be option.
> > > > > >
> > > > > >         int vrange(start, len, VRANGE_VOLATILE|VRANGE_ZERO, &purged);
> > > > > >         int vrange(start, len, VRANGE_VOLATILE|VRANGE_SIGNAL, &purged);
> > > > > 
> > > > > So, the zero-fill on volatile access feels like a *very* special case
> > > > > to me, since a null page could be valid data in many cases. Since
> > > > > support/interest for volatile ranges has been middling at best, I want
> > > > > to start culling the stranger use cases. I'm open in the future to
> > > > > adding a special flag or something if it really make sense, but at
> > > > > this point, lets just get the more general volatile range use cases
> > > > > supported.
> > > > 
> > > > I'm not sure it's special case. Because some user could reserve
> > > > a big volatile VMA and want to use the range by circle queue for
> > > > caching so overwriting could happen easily.
> > > > We should call vrange(NOVOLATILE) to prevent SIGBUS right before
> > > > overwriting. I feel it's unnecessary overhead and we could avoid
> > > > the cost with VRANGE_ZERO.
> > > > Do you think this usecase would be rare?
> > >   If I understand it correctly the buffer would be volatile all the time
> > > and userspace would like to opportunistically access it. Hum, but then with
> > > your automatic zero-filling it could see half of the page with data and
> > > half of the page zeroed out (the page got evicted in the middle of
> > > userspace reading it). I don't think that's a very comfortable interface to
> > > work with (you would have to very carefully verify the data you've read is
> > > really valid). And frankly in most cases I'm afraid the application would
> > > fail to do proper verification and crash randomly under memory pressure. So
> > > I wouldn't provide VRANGE_ZERO unless I come across real people for which
> > > avoiding marking the range as NONVOLATILE is a big deal and they are OK with
> > > handling all the odd situations that can happen.
> > 
> > Plaes think following usecase.
> > 
> > Let's assume big volatile cacne.
> > If there is request for cache, it should find a object in a cache
> > and if it found, it should call vrange(NOVOLATILE) right before
> > passing it to the user and investigate it was purged or not.
> > If it wasn't purged, cache manager could pass the object to the user.
> > But it's circular cache so if there is no request from user, cache manager
> > always overwrites objects so it could encounter SIGBUS easily
> > so as current sematic, cache manager always should call vrange(NOVOLATILE)
> > right before the overwriting. Otherwise, it should register SIGBUS handler
> > to unmark volatile by page unit. SIGH.
> > 
> > If we support VRANGE_ZERO, cache manager could overwrite object without
> > SIGBUS handling or vrange(NOVOLATILE) call. Just need is vrange(NOVOLATILE)
> > call while cache manager pass it to the user.
>   OK, that makes some sense but I don't think we have to implement this
> functionality in the beginning...

Yeb, I am not strong against the idea which starts syscall as simple one
but make room for future but I believe scenario I mentioned is one of
typical usecase for volatile cache and it could avoid vrange(NOVOLATILE)
which is heavier than vrange(VOLATILE) because NOVOLATILE should enumerate
all of ptes in the range at current implementation so reducing NOVOATILE
call looks important to me.


> 								Honza
> -- 
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2014-03-21  5:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 18:33 [PATCH 0/3] Volatile Ranges (v11) John Stultz
2014-03-14 18:33 ` [PATCH 1/3] vrange: Add vrange syscall and handle splitting/merging and marking vmas John Stultz
2014-03-17  9:21   ` Jan Kara
2014-03-17  9:43     ` Jan Kara
2014-03-18  0:36       ` John Stultz
2014-03-17 22:19     ` John Stultz
2014-03-14 18:33 ` [PATCH 2/3] vrange: Add purged page detection on setting memory non-volatile John Stultz
2014-03-17  9:39   ` Jan Kara
2014-03-17 22:22     ` John Stultz
2014-03-14 18:33 ` [PATCH 3/3] vrange: Add page purging logic & SIGBUS trap John Stultz
2014-03-18 12:24 ` [PATCH 0/3] Volatile Ranges (v11) Michal Hocko
2014-03-18 17:53   ` John Stultz
2014-03-20  0:38   ` Dave Hansen
2014-03-20  0:57     ` John Stultz
2014-03-20  7:45     ` Minchan Kim
2014-03-18 15:11 ` Minchan Kim
2014-03-18 18:07   ` John Stultz
2014-03-19  0:49     ` Minchan Kim
2014-03-19 10:12       ` Jan Kara
2014-03-20  1:09         ` Minchan Kim
2014-03-20  8:13           ` Jan Kara
2014-03-21  5:29             ` Minchan Kim [this message]

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=20140321052936.GB7450@bbox \
    --to=minchan@kernel.org \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave@sr71.net \
    --cc=dmitry.adamushko@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=mh@glandium.org \
    --cc=neilb@suse.de \
    --cc=riel@redhat.com \
    --cc=rlove@google.com \
    --cc=tglek@mozilla.com \
    --cc=walken@google.com \
    /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;
as well as URLs for NNTP newsgroup(s).