mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Cc: Hugh Dickins <hugh@veritas.com>, Greg KH <gregkh@suse.de>,
	Maksim Yevmenkin <maksim.yevmenkin@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Nick Piggin <npiggin@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	will@crowder-design.com, Rik van Riel <riel@redhat.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Mikos Szeredi <miklos@szeredi.hu>
Subject: Re: [PATCH] Fix OOPS in mmap_region() when merging adjacent VM_LOCKED file segments
Date: Tue, 3 Feb 2009 08:40:56 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.0902030822450.3247@localhost.localdomain> (raw)
In-Reply-To: <1233677610.15321.129.camel@lts-notebook>



On Tue, 3 Feb 2009, Lee Schermerhorn wrote:
> 
> This reminded me of something I'd seen recently looking
> at /proc/<pid>/[numa]_maps for <a large commercial database> on
> Linux/x86_64: 
> 
> 2adadf2b9000-2adadf2c0000 rwxp 00000000 00:0e 4072                       /dev/zero
> 
> For portability between Linux and various Unix-like systems that don't
> support MAP_ANON*, perhaps?

Odd. 

At first I thought that it is just that Linux will turn a MAP_SHARED | 
MAP_ANON into that /dev/zero thing, so you won't be able to tell by lookup 
at /proc/maps. So it would be very possible that the application did not 
actually open /dev/zero at all, and used MAP_ANON instead (see the whole 
shmem_zero_setup() and shmem_file_setup() thing).

But those mappings have that 'p' for private there, so it's not 
MAP_SHARED. And yes, that means that your large commercial database really 
did open /dev/zero and mapped it privately. They must be living in the 
past.

> Anyway, from the addresses and permissions, these all look potentially
> mergeable.  The offset is preventing merging, right?  I guess that's one
> of the downsides of mapping /dev/zero rather than using MAP_ANONYMOUS?

Yeah. The MAP_ANON code has a total hack:

                case MAP_PRIVATE:
                        /*
                         * Set pgoff according to addr for anon_vma.
                         */
                        pgoff = addr >> PAGE_SHIFT;
                        break;

where the whole point is to allow sharing: since pgoff doesn't matter, we 
can make it be something that will merge _if_ you don't play games (of 
course, if you then start usign mremap to move things around, that all 
breaks, and you lose the merging ;)

That said, if it's just a hundred segments, nobody really cares. It's 
going to make vma lookup fractionally slower, but not so anybody would 
likely ever notice even in benchmarks. And if it's just this one db, it's 
certainly not going to use any noticeable amount of memory either.

Merging is important, but it's important to avoid the _really_ common 
cases, and to make /proc/maps more readable etc. It's not like it matters 
for the occasional crazy setup.

But you could still try to teach the DB people to use MAP_ANON.

			Linus

  reply	other threads:[~2009-02-03 16:42 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bb4a86c70901281151w4300605r3882461cd6e9774a@mail.gmail.com>
     [not found] ` <alpine.LFD.2.00.0901281316450.3123@localhost.localdomain>
2009-01-29 20:03   ` Lee Schermerhorn
2009-01-29 20:33     ` Linus Torvalds
2009-01-29 20:48       ` Linus Torvalds
2009-01-29 22:32         ` Hugh Dickins
2009-01-29 23:02           ` Linus Torvalds
2009-01-30  4:43             ` Lee Schermerhorn
2009-01-30  4:49               ` Linus Torvalds
2009-01-29 22:47         ` Maksim Yevmenkin
2009-01-29 22:48           ` Randy Dunlap
2009-01-29 23:31             ` Maksim Yevmenkin
2009-01-30  2:08           ` Linus Torvalds
2009-01-30  5:56             ` Greg KH
2009-01-30 16:36               ` Linus Torvalds
2009-01-30 17:40                 ` Hugh Dickins
2009-01-30 18:14                   ` Linus Torvalds
2009-01-30 18:30                     ` Hugh Dickins
2009-01-30 19:53                     ` Lee Schermerhorn
2009-01-30 20:31                       ` Linus Torvalds
2009-01-30 21:12                         ` Hugh Dickins
2009-01-30 21:25                           ` Linus Torvalds
2009-01-30 21:36                           ` Lee Schermerhorn
2009-01-30 22:27                             ` Linus Torvalds
2009-01-31 12:35                               ` Hugh Dickins
2009-01-31 18:34                                 ` Linus Torvalds
2009-02-02 11:59                                   ` KOSAKI Motohiro
2009-02-02 12:54                                     ` Hugh Dickins
2009-02-02 14:10                                       ` KOSAKI Motohiro
2009-02-02 18:58                                         ` Mel Gorman
2009-02-02 19:23                                           ` Linus Torvalds
2009-02-02 21:50                                             ` Mel Gorman
2009-02-02 22:12                                               ` Linus Torvalds
2009-02-02 22:35                                                 ` Mel Gorman
2009-02-02 18:33                                       ` Mel Gorman
2009-02-03 16:13                                 ` Lee Schermerhorn
2009-02-03 16:40                                   ` Linus Torvalds [this message]
2009-02-03 17:10                                   ` Hugh Dickins
2009-02-03 21:50                                     ` Lee Schermerhorn
2009-01-30 21:37                           ` Linus Torvalds
2009-01-31 12:16                             ` Hugh Dickins
2009-01-30 20:33                       ` Hugh Dickins
2009-01-30 20:53                       ` Randy Dunlap
2009-01-30 20:59                         ` Lee Schermerhorn
2009-01-30 21:11                           ` Will Crowder
2009-01-30 23:44                   ` Greg KH
2009-01-30  8:34         ` Peter Zijlstra
2009-01-30 16:45           ` Linus Torvalds
2009-01-30 16:49             ` Randy Dunlap

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=alpine.LFD.2.00.0902030822450.3247@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=Lee.Schermerhorn@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=hugh@veritas.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maksim.yevmenkin@gmail.com \
    --cc=miklos@szeredi.hu \
    --cc=npiggin@suse.de \
    --cc=riel@redhat.com \
    --cc=will@crowder-design.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

Powered by JetHome