mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Jeff Smith <jsmith.lkml@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Kenny Simpson <theonetruekenny@gmail.com>,
	Michal Hocko <mhocko@suse.cz>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Dave Jones <davej@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: remap_file_pages() use
Date: Mon, 26 May 2014 12:42:40 +0300 (EEST)	[thread overview]
Message-ID: <20140526094240.B5508E009B@blue.fi.intel.com> (raw)
In-Reply-To: <CAAih0NjpHKc11JfG3MOnvisXesg-LoaS0Cx1rOA5ggDEHNfY6g@mail.gmail.com>

Jeff Smith wrote:
> On Mon, May 19, 2014 at 9:38 AM, Christoph Hellwig <hch@infradead.org> wrote:
> > On Mon, May 19, 2014 at 05:35:40PM +0300, Kirill A. Shutemov wrote:
> >> >From functional POV, emulation *should* be identical to original
> >> remap_file_pages(), but slower. It would be nice, if you test it early.
> >>
> >> It's not clear yet how long emulation will be there.
> >
> > Stop right there.  We found out about two real life users of
> > remap_file_pages() already, without even committing the patches to warn
> > about using it to any tree.
> >
> > I think at this point the whole idea of removing the API should be dead
> > on the floor, as we do not needlessly break userspace programs.
> >
> > If we can get rid of the ugly guts and provide a good enough emulation
> > that the user won't cry I'd love to get rid of this cruft, but even
> > that doesn't look certain yet.
> 
> Sorry for being late to the party, but I just noticed this proposal
> via the LWN summary byline.
> 
> I wanted to comment that Kenny's use case is (I believe) quite
> widespread. I've used the technique since ~2008, and I've come across
> other people in subsequent jobs who independently developed the same
> technique. Mirrored mapping is absolutely required by several
> independent proprietary platforms I'm aware of, and remap_file_pages()
> has historically been the only sane way to accomplish this. (i.e.,
> shm_open(), mmap(NULL, 2^(n+1) pages), remap_file_pages() on 2nd
> half).

Em.. What's wrong with shm_open() + two mmap()s to cover both halfs?

fd = shm_open();
addr1 = mmap(NULL, 2*SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
addr2 = mmap(addr1 + SIZE, PROT_READ|PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0);

Is there a reason why it doens't work?

> It may not be individuals who are involved in the kernel development
> scene to any great extent, but I am sure that remap_file_pages() being
> deprecated would seriously piss off a lot of individuals. The pattern
> has even had a section in the Wikipedia article for quite some time:
> http://en.wikipedia.org/wiki/Circular_buffer#Mirroring

I believe remap_file_pages() is abused here. But it seems we will have to
keep emulation in place for a long time.

> 
> It would be most preferable from a user standpoint to keep the
> existing system intact, but failing that, a reservation API would need
> to be created (possibly a MAP_RESERVE flag) that would set aside a
> region that could only be subsequently mapped via explicit
> address-requesting mmap() calls.

I don't get this part.

-- 
 Kirill A. Shutemov

  reply	other threads:[~2014-05-26  9:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-18  4:03 Kenny Simpson
2014-05-19 13:01 ` Michal Hocko
2014-05-19 14:35   ` Kirill A. Shutemov
2014-05-19 14:38     ` Christoph Hellwig
2014-05-19 15:02       ` Kirill A. Shutemov
2014-05-19 15:11         ` Christoph Hellwig
2014-05-19 15:17           ` Kirill A. Shutemov
2014-05-19 15:42             ` Armin Rigo
2014-05-19 15:53               ` Kirill A. Shutemov
2014-05-19 16:42                 ` Armin Rigo
2014-05-19 17:50                   ` Dave Hansen
2014-05-19 22:05                     ` Armin Rigo
2014-05-19 16:56             ` Christoph Hellwig
2014-05-19 19:14             ` Richard Weinberger
2014-05-26  0:19       ` Jeff Smith
2014-05-26  9:42         ` Kirill A. Shutemov [this message]
2014-05-26 13:24           ` Jeff Smith
2014-05-26 13:35             ` Paolo Bonzini
2014-05-26 13:38               ` Jeff Smith
2014-05-26 13:47                 ` Kirill A. Shutemov
2014-05-26 13:52                   ` Jeff Smith
2014-05-26 14:16                     ` Kirill A. Shutemov
2014-05-26 13:37             ` Kirill A. Shutemov
2014-05-19 17:34     ` Kenny Simpson
2014-05-19 21:24       ` Kirill A. Shutemov
2014-05-21  1:53         ` Kenny Simpson
2014-05-21  3:56           ` Kenny Simpson
2014-05-21  4:32             ` Hugh Dickins

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=20140526094240.B5508E009B@blue.fi.intel.com \
    --to=kirill.shutemov@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=hch@infradead.org \
    --cc=jsmith.lkml@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=peterz@infradead.org \
    --cc=theonetruekenny@gmail.com \
    --cc=torvalds@linux-foundation.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

Powered by JetHome