From: Minchan Kim <minchan.kim@gmail.com>
To: Dmitry Fink <dmitry.fink@palm.com>
Cc: Hugh Dickins <hughd@google.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mmap: Fix and tidy up overcommit page arithmetic
Date: Mon, 11 Jul 2011 08:08:46 +0900 [thread overview]
Message-ID: <CAEwNFnDRZwSXnVP3EdXqYnNBrumcrihQ+m=N4fb9xouNE=TKRg@mail.gmail.com> (raw)
In-Reply-To: <1310244907-10144-1-git-send-email-dmitry.fink@palm.com>
On Sun, Jul 10, 2011 at 5:55 AM, Dmitry Fink <dmitry.fink@palm.com> wrote:
> - shmem pages are not immediately available, but they are not
> potentially available either, even if we swap them out, they will
> just relocate from memory into swap, total amount of immediate and
> potentially available memory is not going to be affected, so we
> shouldn't count them as potentially free in the first place.
>
> - nr_free_pages() is not an expensive operation anymore, there is
> no need to split the decision making in two halves and repeat code.
>
> Signed-off-by: Dmitry Fink <dmitry.fink@palm.com>
> Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
> Acked-by: Hugh Dickins <hughd@google.com>
> ---
> mm/mmap.c | 33 ++++++++++++---------------------
> mm/nommu.c | 33 ++++++++++++---------------------
> 2 files changed, 24 insertions(+), 42 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index d49736f..b6ed22e 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -122,9 +122,16 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
> return 0;
>
> if (sysctl_overcommit_memory == OVERCOMMIT_GUESS) {
> - unsigned long n;
> + free = global_page_state(NR_FREE_PAGES);
> + free += global_page_state(NR_FILE_PAGES);
> +
> + /* shmem pages shouldn't be counted as free in this
Nitpick.
You didn't correct comment style. It's not a linux kernel coding style.
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-07-10 23:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-03 19:39 [PATCH 1/1] mmap: Don't count shmem pages as free in __vm_enough_memory Dmitry Fink
2011-07-04 0:43 ` Minchan Kim
2011-07-04 3:10 ` Dmitry Fink (Palm GBU)
2011-07-04 3:48 ` Minchan Kim
2011-07-08 22:22 ` Hugh Dickins
2011-07-09 20:42 ` [PATCH] mmap: Fix and tidy up overcommit page arithmetic Dmitry Fink
2011-07-09 20:55 ` Dmitry Fink
2011-07-10 23:08 ` Minchan Kim [this message]
2011-07-11 1:41 ` Dmitry Fink
2011-07-11 17:33 ` 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='CAEwNFnDRZwSXnVP3EdXqYnNBrumcrihQ+m=N4fb9xouNE=TKRg@mail.gmail.com' \
--to=minchan.kim@gmail.com \
--cc=dmitry.fink@palm.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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