lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1313075625.50520.YahooMailNeo@web111715.mail.gq1.yahoo.com>
Date:	Thu, 11 Aug 2011 08:13:45 -0700 (PDT)
From:	Mahmood Naderan <nt_mahmood@...oo.com>
To:	Denys Vlasenko <vda.linux@...glemail.com>
Cc:	David Rientjes <rientjes@...gle.com>,
	Randy Dunlap <rdunlap@...otime.net>,
	"\"linux-kernel@...r.kernel.org\"" <linux-kernel@...r.kernel.org>,
	"\"linux-mm@...ck.org\"" <linux-mm@...ck.org>
Subject: Re: running of out memory => kernel crash

>What it can possibly do if there is no swap and therefore it 

>can't free memory by writing out RAM pages to swap?


>the disk activity comes from constant paging in (reading)
>of pages which contain code of running binaries.

Why the disk activity does not appear in the first scenario?


>Thus the only option is to find some not recently used page
> with read-only, file-backed content (usually some binary's 

>text page, but can be any read-only file mapping) and reuse it.
Why "killing" does not appear here? Why it try to "find some 

recently used page"?


Both scenarios have one common thing... Running out of memory.
But they behave differently.


// Naderan *Mahmood;


________________________________
From: Denys Vlasenko <vda.linux@...glemail.com>
To: Mahmood Naderan <nt_mahmood@...oo.com>
Cc: David Rientjes <rientjes@...gle.com>; Randy Dunlap <rdunlap@...otime.net>; """"linux-kernel@...r.kernel.org"""" <linux-kernel@...r.kernel.org>; """linux-mm@...ck.org""" <linux-mm@...ck.org>
Sent: Thursday, August 11, 2011 5:17 PM
Subject: Re: running of out memory => kernel crash

On Thu, Aug 11, 2011 at 10:02 AM, Mahmood Naderan <nt_mahmood@...oo.com> wrote:
>>Despite it's name, kswapd is still active, it's trying to reclaim memory
>>to prevent having to kill a process as the last resort.
>
> I understand what you said, but I did two scenarios:
> 1- I wrote a simple C++ program that "new" a lot of pointers.
>    for ( int i = 0; i < n; i++ ) {
>      for ( int j = 0; j < n; j++ ) {
>        for ( int k = 0; k < n; k++ ) {
>          for ( int l = 0; l < n; l++ ) {
>            double *ptr1 = new double[n*i];
>            double *ptr2 = new double[n*j];
>      }}}}
>
> When I run the program, it ill eat the memory and when it reaches the
> maximum ram, it get killed and I saw  message on terminal:
>
> mahmood@vpc:~$ ./leak
> Killed
>
> for this scenario, there is no kswapd process running.

Why do you think kswapd should get active? What it can possibly do
if there is no swap and therefore it can't free memory by writing
out RAM pages to swap?

> 2- There is 300MB ram. I opened an application saw that
> free space reduced to 100MB, then another application reduced the free
> space to 30MB. Another application reduced to 4MB. Now the "kswapd"
> is running with a lot of disk activity and tries to keep free space at 4MB.
> In this scenario, No application is killed.
>
> The question is why in one scenario, the application is killed and in one
> scenario, kswapd is running.

In scenario 2, the disk activity comes from constant paging in (reading)
of pages which contain code of running binaries.

Since machine has no free RAM and no swap at all, when it needs
a free page it can't swap out a dirty (modified) page or anon
(usually malloced space) page. Thus the only option is to find some
not recently used page with read-only, file-backed content (usually some
binary's text page, but can be any read-only file mapping) and reuse it.

If there are no really old, unused read-only, file-backed pages,
then the discarded page will be needed soon, will need to be read from disk,
and will evict another similar page. Which will be needed soon too,
will need to be read from disk, and will evict another such page...
ad infinitum.

-- 
vda 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ