(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@xxxxxxxxxxxxxxxxxxx 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@xxxxxxxxxxxxxxxxxxxx > Reporter: terragonjohn@xxxxxxxxx > 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.