linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* why the kmalloc return fail when there is free physical address but return success after dropping page caches
@ 2016-05-18  2:38 baotiao
  2016-05-18  8:45 ` Vlastimil Babka
  0 siblings, 1 reply; 5+ messages in thread
From: baotiao @ 2016-05-18  2:38 UTC (permalink / raw)
  To: linux-mm

[-- Attachment #1: Type: text/plain, Size: 1640 bytes --]

Hello every, I meet an interesting kernel memory problem. Can anyone help me explain what happen under the kernel

The machine's status is describe as blow:

the machine has 96 physical memory. And the real use memory is about 64G, and the page cache use about 32G. we also use the swap area, at that time we have about 10G(we set the swap max size to 32G). At that moment, we find xfs report

Apr 29 21:54:31 w-openstack86 kernel: XFS: possible memory allocation deadlock in kmem_alloc (mode:0x250)

after reading the source code. This message is display from this line

ptr = kmalloc(size, lflags); if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP))) return ptr; if (!(++retries % 100)) xfs_err(NULL, "possible memory allocation deadlock in %s (mode:0x%x)", __func__, lflags); congestion_wait(BLK_RW_ASYNC, HZ/50);

The error is cause by the kmalloc() function, there is not enough memory in the system. But there is still 32G page cache.

So I run

echo 3 > /proc/sys/vm/drop_caches

to drop the page cache.

Then the system is fine. But I really don't know the reason. Why after I run drop_caches operation the kmalloc() function will success? I think even we use whole physical memory, but we only use 64 real momory, the 32G memory are page cache, further we have enough swap space. So why the kernel don't flush the page cache or the swap to reserved the kmalloc operation.


----------------------------------------
 
Github: https://github.com/baotiao
Blog: http://baotiao.github.io/
Stackoverflow: http://stackoverflow.com/users/634415/baotiao 
Linkedin: http://www.linkedin.com/profile/view?id=145231990


[-- Attachment #2: Type: text/html, Size: 4093 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-25  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18  2:38 why the kmalloc return fail when there is free physical address but return success after dropping page caches baotiao
2016-05-18  8:45 ` Vlastimil Babka
2016-05-18  8:58   ` baotiao
2016-05-18 14:41     ` Dave Chinner
2016-05-25  9:25       ` 陈宗志

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).