* Re: [Bug 200105] New: High paging activity as soon as the swap is touched (with steps and code to reproduce it)
[not found] <bug-200105-27@https.bugzilla.kernel.org/>
@ 2018-06-18 23:17 ` Andrew Morton
2018-06-21 15:13 ` Michal Hocko
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Morton @ 2018-06-18 23:17 UTC (permalink / raw)
To: linux-mm; +Cc: bugzilla-daemon, terragonjohn
(switched to email. Please respond via emailed reply-to-all, not via the
bugzilla web interface).
On Sun, 17 Jun 2018 21:56:23 +0000 bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=200105
>
> Bug ID: 200105
> Summary: High paging activity as soon as the swap is touched
> (with steps and code to reproduce it)
> Product: Memory Management
> Version: 2.5
> Kernel Version: 4.14 4.15 4.16 4.17
> Hardware: All
> OS: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: Page Allocator
> Assignee: akpm@linux-foundation.org
> Reporter: terragonjohn@yahoo.com
> Regression: No
>
> Hi.
>
> Under any desktop environment, as soon as the swap is touched the kernel starts
> paging out gigabytes of memory for no apparent reason causing the system to
> freeze for at least a minute.
>
>
> This happens with normal desktop usage but I'm able to reproduce this behavior
> systematically by using the code included at the end of this report, let's call
> it "memeater". memeater takes three parameters: totalmem, chunksize, sleeptime.
> It allocates (and initializes to 0) totalmem bytes of memory in chunks of
> chunksize bytes each. After each chunk allocation it sleeps for sleeptime
> seconds. If sleeptime=0, it does not sleep in between chunk allocations.
> After totalmem bytes of memory have been allocated it sleeps indefinitely.
>
> To reproduce the behaviour using memeater:
>
> 1) start a desktop environment (in my case KDE plasma).
> 2) invoke "memeater x y 0" to bring the system to the brink of swapping. I
> usually execute "memeater x y 0" multiple times where x is 4 gigs and y is 20
> megs.(I've got 16GB of memory so I usually go up to 14/15 GB of used memory).
> 3) invoke "memeater x y 1" one last time so that it slowly fills up the memory
> with small chunks of a few megs each (again, I tried it with x=4 gigs and y=20
> megs).
>
> When the last memeater fills the memory (and keeps allocating chunks) I would
> expect the mm system to swap out few megabytes worth of pages to accomodate the
> new requests slowly coming from the last memeater.
> However, what actually happens is that the mm starts to swap out gigabytes
> worth of pages completely freezing the system for one or two minutes.
>
> I've verified this on various desktop systems, all using SSDs.
> Obviously, I'm willing to provide more info and to test patches.
>
>
> ####### memeater #######################à
>
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
> #include <unistd.h>
>
>
>
> int main(int argc, char** argv) {
> long int max = -1;
> int mb = 0;
> long int size = 0;
> long int total = 0;
> int sleep_time = 0;
> char* buffer;
>
> if(argc > 1)
> {
> max = atol(argv[1]);
> size = atol(argv[2]);
> sleep_time = atoi(argv[3]);
> }
> printf("Max: %lu bytes\n", max);
> while((buffer=malloc(size)) != NULL && total < max) {
> memset(buffer, 0, size);
> mb++;
> total=mb*size;
> printf("Allocated %lu bytes\n", total);
> if (sleep_time) sleep(sleep_time);
> }
> sleep(3000000);
> return 0;
> }
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Bug 200105] New: High paging activity as soon as the swap is touched (with steps and code to reproduce it)
2018-06-18 23:17 ` [Bug 200105] New: High paging activity as soon as the swap is touched (with steps and code to reproduce it) Andrew Morton
@ 2018-06-21 15:13 ` Michal Hocko
0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2018-06-21 15:13 UTC (permalink / raw)
To: terragonjohn; +Cc: linux-mm, bugzilla-daemon, Andrew Morton
On Mon 18-06-18 16:17:35, Andrew Morton wrote:
[...]
> > I've verified this on various desktop systems, all using SSDs.
> > Obviously, I'm willing to provide more info and to test patches.
Could you snapshot /proc/vmstat during your test please? Once per second
or so should tell us more what is going on.
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-21 15:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-200105-27@https.bugzilla.kernel.org/>
2018-06-18 23:17 ` [Bug 200105] New: High paging activity as soon as the swap is touched (with steps and code to reproduce it) Andrew Morton
2018-06-21 15:13 ` Michal Hocko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.