From: hooanon05@yahoo.co.jp
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: __vm_enough_memory(), OVERCOMMIT_NEVER, current->mm, kernel thread
Date: Wed, 22 Oct 2008 08:10:54 +0900 [thread overview]
Message-ID: <6775.1224630654@jrobl> (raw)
In-Reply-To: <20081021164619.341f01d9@lxorguk.ukuu.org.uk>
Alan Cox:
> Calling into the file system code assuming that current->mm is
> NULL isn't safe and hasn't been for a very long time since someone added
> the 3% hack.
I guess
- people don't care overcommit and leave it as default, so they don't
meet the problem
- people who cares overcommit has rich memory, and they don't meet the
problem too.
> The shmem case is actually a bit special so my thoughts are:
>
> Make security_vm_enough_memory() WARN() if current->mm = NULL
> Make security_vm_enough_memory_mm() WARN() if the passed mm = NULL
> Add security_vm_enough_memory_fs() which does not do the warning test
>
> All would still call security->ops->vm_enough_memory and then
> __vm_enough_memory() would skip the 3% adjustment when the passed mm was
> NULL
>
> Does that sound sensible ?
In your first option, write() to the exported tmpfs will produce the
warning on nfs server even if much memory is left. I don't think it is a
good idea.
I'd suggest to make __vm_enough_memory() would skip the 3% adjustment
only.
--- /src/linux-2.6/linux-2.6.27/mm/mmap.c 2008-10-10 07:13:53.000000000 +0900
+++ /tmp/mmap.c 2008-10-22 08:07:09.000000000 +0900
@@ -173,9 +173,10 @@
allowed -= allowed / 32;
allowed += total_swap_pages;
- /* Don't let a single process grow too big:
+ /* Don't let a single user process grow too big:
leave 3% of the size of this process for other processes */
- allowed -= mm->total_vm / 32;
+ if (mm)
+ allowed -= mm->total_vm / 32;
/*
* cast `allowed' as a signed long because vm_committed_space
Junjiro R. Okajima
next prev parent reply other threads:[~2008-10-21 23:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-21 15:14 __vm_enough_memory(), OVERCOMMIT_NEVER, current->mm, kernel thread hooanon05
2008-10-21 15:46 ` Alan Cox
2008-10-21 23:10 ` hooanon05 [this message]
2008-10-22 5:35 ` hooanon05
2008-10-22 8:27 ` Alan Cox
2008-10-22 11:26 ` hooanon05
2008-10-22 12:09 ` Alan Cox
2008-10-22 12:46 ` hooanon05
2008-10-22 13:37 ` James Morris
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=6775.1224630654@jrobl \
--to=hooanon05@yahoo.co.jp \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.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