linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Tom May" <tom@tommay.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/8][for -mm] mem_notify v6
Date: Mon, 21 Apr 2008 13:32:06 -0700	[thread overview]
Message-ID: <ab3f9b940804211332i2e75c19co286d7ba1c69ca99b@mail.gmail.com> (raw)
In-Reply-To: <20080418170129.A8DF.KOSAKI.MOTOHIRO@jp.fujitsu.com>

On Fri, Apr 18, 2008 at 3:07 AM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> wrote:

>  I investigated again and found 2 problem in your test program.
>
>  1. text segment isn't locked.
>
>    if strong memory pressure happned, kernel may drop program text region.
>    then your test program suddenly slow down.
>
>    please use mlockall(MCL_CURRENT) before large buffer allocation.

Using mlock does enable the program to respond faster (and/or the
kernel doesn't have to find memory to fault the page in) and solves
the problem for this simple test program.  I think we're thinking of
the solution in two different ways: you want the program to react more
quickly or be "nicer", and I want the kernel to give notification
early enough to allow time for things that can (and do) happen when
things aren't so nice. I realize that in extreme circumstances oom may
be unavoidable, but a threshold-based notification, in addition to the
current /dev/mem_notify mechanism, would help avoid extreme
circumstances.  I'm going to look into doing this.

>  2. repeat open/close to /proc/meminfo.
>
>    in the fact, open(2) system call use a bit memory.
>    if call open(2) in strong memory pressure, doesn't return until
>    memory freed enough.
>    thus, it cause slow down your program sometimes.

This should be fine; I intentionally do the open/read/write/close
after freeing memory.

>  attached changed test program :)
>  it works well on my test environment.

I made your changes to my program (I'm using clone since I don't have
a pthreads library on my device, and I left PAGESIZE at 4K instead of
64K), and having memory locked does avoid oom in this case, but
unfortunately I don't think it's a general solution that will work
everywhere in my system.  (Although I'm going to try it.)

Thanks,
.tom

--
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:[~2008-04-21 20:32 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-09 15:19 [PATCH 0/8][for -mm] mem_notify v6 KOSAKI Motohiro
2008-02-09 16:02 ` Jon Masters
2008-02-09 16:33   ` KOSAKI Motohiro
2008-02-09 16:43     ` Rik van Riel
2008-02-09 16:49       ` KOSAKI Motohiro
2008-02-11 15:36 ` [PATCH 0/8][for -mm] mem_notify v6, " Jonathan Corbet
2008-02-11 15:46   ` KOSAKI Motohiro
2008-02-17 14:49 ` Paul Jackson
2008-02-19  7:36   ` KOSAKI Motohiro
2008-02-19 15:00     ` Paul Jackson
2008-02-19 19:02       ` Rik van Riel
2008-02-19 20:18         ` Paul Jackson
2008-02-19 20:43           ` Paul Jackson
2008-02-19 22:28       ` Pavel Machek
2008-02-20  1:54         ` Paul Jackson
2008-02-20  2:07         ` Rik van Riel
2008-02-20  2:48           ` KOSAKI Motohiro
2008-02-20  4:57             ` Paul Jackson
2008-02-20  5:21               ` KOSAKI Motohiro
2008-02-20  4:36           ` Paul Jackson
2008-04-01 23:35 ` Tom May
2008-04-02  7:31   ` KOSAKI Motohiro
2008-04-02 17:45     ` Tom May
2008-04-15  0:16     ` Tom May
2008-04-16  2:30       ` KOSAKI Motohiro
2008-04-17  9:30       ` KOSAKI Motohiro
2008-04-17 19:23         ` Tom May
2008-04-18 10:07           ` KOSAKI Motohiro
2008-04-21 20:32             ` Tom May [this message]
2008-04-23  8:27           ` Daniel Spång
2008-05-01  2:07             ` Tom May
2008-05-01 15:06               ` KOSAKI Motohiro
2008-05-02 22:21                 ` Tom May
2008-05-03 12:26                   ` KOSAKI Motohiro
2008-05-06  5:22                     ` Tom May

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=ab3f9b940804211332i2e75c19co286d7ba1c69ca99b@mail.gmail.com \
    --to=tom@tommay.com \
    --cc=kosaki.motohiro@jp.fujitsu.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;
as well as URLs for NNTP newsgroup(s).