page allocation failure: order:0

555 views
Skip to first unread message

Rohit Singh

unread,
Jul 3, 2021, 8:18:13 AM7/3/21
to SysPlay's Inside Linux
Hello everyone.

I am trying to read pages of a file (allocating a page in page cache and reading data from file into this page), writing some content to these pages.
As a result these pages are getting  dirty.

After a point when I try to allocate a page in page cache to read more data from disk, I get page allocation failure: order:0.

I was thinking that kernel will automatically flush dirty pages to disk and this kind of failure shouldn't happen. 

Any suggestions to fix this.

Thanks
Rohit Singh

PS:
============= Parital Log ===============

 page allocation failure: order:0, mode:0x0(), nodemask=(null),cpuset=/,mems_allowed=0
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
 Call Trace:
  dump_stack+0x6d/0x95
  warn_alloc+0xfe/0x160
  __alloc_pages_slowpath+0xdec/0xe20
  ? __wake_up_common_lock+0x8c/0xc0
  __alloc_pages_nodemask+0x2cd/0x320
  alloc_pages_current+0x6a/0xe0
  __page_cache_alloc+0x6a/0xa0
  pagecache_get_page+0xab/0x2c0
 ..
 ..
 ..
 active_anon:52152 inactive_anon:43502 isolated_anon:21
  active_file:147868 inactive_file:1694892 isolated_file:57
  unevictable:0 dirty:114340 writeback:43 unstable:0
  slab_reclaimable:47394 slab_unreclaimable:10121
  mapped:53341 shmem:361 pagetables:4833 bounce:0
  free:28645 free_pcp:1317 free_cma:0
 Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
 1842996 total pagecache pages
 1 pages in swap cache
 Swap cache stats: add 5, delete 4, find 0/0
 Free swap  = 2096880kB
 Total swap = 2097148kB
 2097015 pages RAM
 0 pages HighMem/MovableOnly
 58868 pages reserved
 0 pages cma reserved
 0 pages hwpoisoned

vandana salve

unread,
Jul 3, 2021, 8:41:26 AM7/3/21
to inside...@googlegroups.com
>>I was thinking that kernel will automatically flush dirty pages to disk and this kind of failure shouldn't happen. 
Flushing dirty pages to disk, writes the data onto disk but it doesn't mean allocated pages are freed.

Failure is seen because there is no free pages available for allocation


--
You received this message because you are subscribed to the Google Groups "SysPlay's Inside Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inside_linux...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/inside_linux/b135422f-5e45-41d8-9551-f56da29d31bfn%40googlegroups.com.

Rohit Singh

unread,
Jul 3, 2021, 8:48:31 AM7/3/21
to SysPlay's Inside Linux
Thanks for the reply.

I am a newbie and my understanding is that if a page is non dirty, it can be freed automatically under low memory.

Anil Kumar Pugalia

unread,
Jul 4, 2021, 2:39:43 AM7/4/21
to inside...@googlegroups.com

Are you doing these page manipulation stuff yourself in the kernel, rather than using the existing framework? If yes, you may be missing some steps.

You may also look into why the swap space is not getting used much.

Regards
Anil
Passion: http://sysplay.in (Playing with Systems)
Rohit Singh wrote on 03/07/21 6:18 pm:

Mahantesh Hadimani

unread,
Jul 8, 2021, 5:48:04 AM7/8/21
to inside_linux

Better if you paste code snippet here, we can analyse the code.
I am not sure which API you are using for allocating page .

Thanks
Mahanesh



--
Thanks
Mahantesh

Rohit Singh

unread,
Jul 13, 2021, 5:58:53 AM7/13/21
to SysPlay's Inside Linux
Sorry, for the late reply.

I am using find_or_create_page(struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask).

I think the problem was that, I was passing gfp_mask as 0. Now, I am passing flags s.a. __GFP_IO, __GFP_FS , __GFP_RECLAIM as gfp_mask and now it's working fine.
Reply all
Reply to author
Forward
0 new messages