Skip to contentSkip to conversation

Kernel WARNING in get_page_from_freelist on Linux 6.7.9

DISCUSSION Alec Moskvin 2 participants 4 messages Mar 9, 2024 – Mar 11, 2024

lore
Share & tools
lore
#0 lore raw

Hello,

I'm getting the warning below when linking with the mold linker on bcachefs. It's very reproducible, and seems to always be triggered by ld.mold.

Please let me know if you need any additional info.

Thanks,
Alec

[  237.959266] ------------[ cut here ]------------
[  237.959272] WARNING: CPU: 6 PID: 2346 at mm/page_alloc.c:2897 get_page_from_freelist+0x916/0xc40
[  237.959285] CPU: 6 PID: 2346 Comm: ld.mold Not tainted 6.7.9 #164
[  237.959289] Hardware name: Gigabyte Technology Co., Ltd. H97-D3H/H97-D3H-CF, BIOS F6 04/21/2015
[  237.959292] RIP: 0010:get_page_from_freelist+0x916/0xc40
[  237.959308] Code: 0f 84 a0 fc ff ff 48 8b 44 24 08 f7 44 24 54 00 80 00 00 8b 40 18 89 44 24 24 0f 84 47 f8 ff ff 41 83 ff 01 0f 86 a3 fa ff ff <0f> 0b e9 36 f8 ff ff 44 89 ee e8 eb 4c fc ff 48 89 44 24 18 e9 8d
[  237.959312] RSP: 0000:ffffb9a3cd197aa0 EFLAGS: 00010202
[  237.959315] RAX: 0000000000000000 RBX: 0000000000000901 RCX: 0000000000000003
[  237.959317] RDX: 0000000000000001 RSI: ffffffffa29ccbd8 RDI: ffffffffa29cca40
[  237.959320] RBP: 3e000000007fffff R08: 0000000000000000 R09: ffffe3fb453f2c08
[  237.959322] R10: 0000000000000002 R11: 0000000000000000 R12: 00000000006656a8
[  237.959323] R13: 0000000000000002 R14: ffffffffa29cca40 R15: 0000000000000003
[  237.959325] FS:  00007f42e08c4780(0000) GS:ffffa1a97dd80000(0000) knlGS:0000000000000000
[  237.959328] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  237.959330] CR2: 00007f42d7f6e007 CR3: 000000017b250002 CR4: 00000000001706f0
[  237.959332] Call Trace:
[  237.959336]  <TASK>
[  237.959338]  ? __warn+0x66/0xc0
[  237.959344]  ? get_page_from_freelist+0x916/0xc40
[  237.959347]  ? report_bug+0x166/0x1b0
[  237.959363]  ? handle_bug+0x3c/0x70
[  237.959371]  ? exc_invalid_op+0x17/0x70
[  237.959375]  ? asm_exc_invalid_op+0x1a/0x20
[  237.959383]  ? get_page_from_freelist+0x916/0xc40
[  237.959386]  ? xas_alloc+0xa4/0xc0
[  237.959390]  ? filemap_get_entry+0x62/0x120
[  237.959395]  __alloc_pages+0x158/0x240
[  237.959397]  __kmalloc_large_node+0x73/0x150
[  237.959400]  __bch2_folio_create+0x34/0x60
[  237.959404]  bch2_readahead+0x11f/0x320
[  237.959407]  read_pages+0x53/0x220
[  237.959410]  page_cache_ra_order+0x1e7/0x320
[  237.959421]  filemap_fault+0x781/0xa10
[  237.959424]  bch2_page_fault+0x159/0x1e0
[  237.959427]  __do_fault+0x2c/0xb0
[  237.959430]  __handle_mm_fault+0xb5f/0x10f0
[  237.959434]  handle_mm_fault+0x186/0x370
[  237.959438]  exc_page_fault+0x15c/0x5c0
[  237.959440]  asm_exc_page_fault+0x26/0x30
[  237.959444] RIP: 0033:0x563215944978
[  237.959446] Code: 00 00 41 55 c5 f9 ef c0 41 54 55 48 89 f5 53 48 83 ec 08 0f b7 05 ca e6 9d ff 48 8b 5f 30 bf 3e 00 00 00 48 03 9e 28 0d 00 00 <c5> fa 7f 43 07 c5 fa 7f 43 17 c5 fa 7f 43 27 c7 03 7f 45 4c 46 66
[  237.959449] RSP: 002b:00007fff71495510 EFLAGS: 00010206
[  237.959452] RAX: 0000000000000102 RBX: 00007f42d7f6e000 RCX: 0000000000000020
[  237.959454] RDX: 00000200001614a0 RSI: 00007fff71495fb0 RDI: 000000000000003e
[  237.959455] RBP: 00007fff71495fb0 R08: 00007fff7150f080 R09: 0000000000000001
[  237.959457] R10: 0000000000000000 R11: 000000000000000a R12: 00007fff714959e0
[  237.959459] R13: 00007fff71495610 R14: 00007f42e05e6a00 R15: 0000000000000000
[  237.959461]  </TASK>
[  237.959462] ---[ end trace 0000000000000000 ]---
#1 lore raw
Quoted 5 lines · Alec Moskvin

Hello,

I'm getting the warning below when linking with the mold linker on bcachefs. It's very reproducible, and seems to always be triggered by ld.mold.

this was a __GFP_NOFAIL use or two we needed to get rid of - it's fixed in 6.8.

#2 lore raw

Hi Kent,

Quoted 2 lines · Kent Overstreet

this was a __GFP_NOFAIL use or two we needed to get rid of - it's fixed in 6.8.

I got the same warning but with a different stack trace on 6.8:

[ 4574.388472] ------------[ cut here ]------------
[ 4574.388479] WARNING: CPU: 7 PID: 127738 at mm/page_alloc.c:2896 get_page_from_freelist+0x9a2/0xcf0
[ 4574.388488] CPU: 7 PID: 127738 Comm: kworker/u16:14 Not tainted 6.8.0 #165
[ 4574.388491] Hardware name: Gigabyte Technology Co., Ltd. H97-D3H/H97-D3H-CF, BIOS F6 04/21/2015
[ 4574.388493] Workqueue: writeback wb_workfn (flush-bcachefs-1)
[ 4574.388499] RIP: 0010:get_page_from_freelist+0x9a2/0xcf0
[ 4574.388503] Code: 0f 84 9f fc ff ff 48 8b 44 24 08 f7 44 24 54 00 80 00 00 8b 40 18 89 44 24 24 0f 84 bc f7 ff ff 41 83 ff 01 0f 86 b0 fa ff ff <0f> 0b e9 ab f7 ff ff 44 89 e6 e8 ff 46 fc ff 48 89 44 24 18 e9 8c
[ 4574.388506] RSP: 0000:ffff922aa2cd38a0 EFLAGS: 00010202
[ 4574.388509] RAX: 0000000000000000 RBX: 0000000000000101 RCX: 0000000000000002
[ 4574.388511] RDX: 0000000000000001 RSI: ffffffff9d5cae10 RDI: ffffffff9d5cacc0
[ 4574.388513] RBP: 0000000000458b96 R08: 0000000000000000 R09: ffffccda45b86c08
[ 4574.388515] R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000002
[ 4574.388517] R13: ffffffff9d5cacc0 R14: 3e000000007fffff R15: 0000000000000002
[ 4574.388519] FS:  0000000000000000(0000) GS:ffff8fbcbddc0000(0000) knlGS:0000000000000000
[ 4574.388521] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4574.388524] CR2: 00007fa3acd3e000 CR3: 000000050a2d4004 CR4: 00000000001706f0
[ 4574.388526] Call Trace:
[ 4574.388529]  <TASK>
[ 4574.388531]  ? __warn+0x66/0xc0
[ 4574.388535]  ? get_page_from_freelist+0x9a2/0xcf0
[ 4574.388538]  ? report_bug+0x166/0x1b0
[ 4574.388542]  ? handle_bug+0x3c/0x70
[ 4574.388545]  ? exc_invalid_op+0x17/0x70
[ 4574.388548]  ? asm_exc_invalid_op+0x1a/0x20
[ 4574.388553]  ? get_page_from_freelist+0x9a2/0xcf0
[ 4574.388555]  ? bch2_btree_node_upgrade+0x48/0x2f0
[ 4574.388560]  __alloc_pages+0x158/0x240
[ 4574.388563]  __kmalloc_large_node+0x6a/0x130
[ 4574.388566]  __bch2_writepage+0x68e/0x7b0
[ 4574.388570]  ? folio_clear_dirty_for_io+0x113/0x180
[ 4574.388574]  write_cache_pages+0x168/0x350
[ 4574.388576]  ? bch2_readpages_end_io+0x240/0x240
[ 4574.388579]  bch2_writepages+0x57/0xb0
[ 4574.388583]  do_writepages+0xba/0x180
[ 4574.388586]  __writeback_single_inode+0x2a/0x190
[ 4574.388588]  writeback_sb_inodes+0x1d2/0x420
[ 4574.388591]  __writeback_inodes_wb+0x47/0xd0
[ 4574.388593]  wb_writeback.isra.0+0x150/0x1a0
[ 4574.388596]  wb_workfn+0x269/0x370
[ 4574.388598]  ? __schedule+0x2cd/0x11c0
[ 4574.388600]  ? drm_sched_job_cleanup+0xd3/0x120
[ 4574.388604]  process_one_work+0x12d/0x240
[ 4574.388609]  worker_thread+0x2e8/0x400
[ 4574.388612]  ? rescuer_thread+0x3f0/0x3f0
[ 4574.388615]  kthread+0xcb/0xf0
[ 4574.388619]  ? kthread_complete_and_exit+0x20/0x20
[ 4574.388622]  ret_from_fork+0x2f/0x50
[ 4574.388625]  ? kthread_complete_and_exit+0x20/0x20
[ 4574.388628]  ret_from_fork_asm+0x11/0x20
[ 4574.388631]  </TASK>
[ 4574.388633] ---[ end trace 0000000000000000 ]---

Thanks,
Alec

#3 lore raw
Quoted 51 lines · Alec Moskvin

Hi Kent,

Quoted 2 lines · Kent Overstreet

this was a __GFP_NOFAIL use or two we needed to get rid of - it's fixed in 6.8.

I got the same warning but with a different stack trace on 6.8:

[ 4574.388472] ------------[ cut here ]------------
[ 4574.388479] WARNING: CPU: 7 PID: 127738 at mm/page_alloc.c:2896 get_page_from_freelist+0x9a2/0xcf0
[ 4574.388488] CPU: 7 PID: 127738 Comm: kworker/u16:14 Not tainted 6.8.0 #165
[ 4574.388491] Hardware name: Gigabyte Technology Co., Ltd. H97-D3H/H97-D3H-CF, BIOS F6 04/21/2015
[ 4574.388493] Workqueue: writeback wb_workfn (flush-bcachefs-1)
[ 4574.388499] RIP: 0010:get_page_from_freelist+0x9a2/0xcf0
[ 4574.388503] Code: 0f 84 9f fc ff ff 48 8b 44 24 08 f7 44 24 54 00 80 00 00 8b 40 18 89 44 24 24 0f 84 bc f7 ff ff 41 83 ff 01 0f 86 b0 fa ff ff <0f> 0b e9 ab f7 ff ff 44 89 e6 e8 ff 46 fc ff 48 89 44 24 18 e9 8c
[ 4574.388506] RSP: 0000:ffff922aa2cd38a0 EFLAGS: 00010202
[ 4574.388509] RAX: 0000000000000000 RBX: 0000000000000101 RCX: 0000000000000002
[ 4574.388511] RDX: 0000000000000001 RSI: ffffffff9d5cae10 RDI: ffffffff9d5cacc0
[ 4574.388513] RBP: 0000000000458b96 R08: 0000000000000000 R09: ffffccda45b86c08
[ 4574.388515] R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000002
[ 4574.388517] R13: ffffffff9d5cacc0 R14: 3e000000007fffff R15: 0000000000000002
[ 4574.388519] FS:  0000000000000000(0000) GS:ffff8fbcbddc0000(0000) knlGS:0000000000000000
[ 4574.388521] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4574.388524] CR2: 00007fa3acd3e000 CR3: 000000050a2d4004 CR4: 00000000001706f0
[ 4574.388526] Call Trace:
[ 4574.388529]  <TASK>
[ 4574.388531]  ? __warn+0x66/0xc0
[ 4574.388535]  ? get_page_from_freelist+0x9a2/0xcf0
[ 4574.388538]  ? report_bug+0x166/0x1b0
[ 4574.388542]  ? handle_bug+0x3c/0x70
[ 4574.388545]  ? exc_invalid_op+0x17/0x70
[ 4574.388548]  ? asm_exc_invalid_op+0x1a/0x20
[ 4574.388553]  ? get_page_from_freelist+0x9a2/0xcf0
[ 4574.388555]  ? bch2_btree_node_upgrade+0x48/0x2f0
[ 4574.388560]  __alloc_pages+0x158/0x240
[ 4574.388563]  __kmalloc_large_node+0x6a/0x130
[ 4574.388566]  __bch2_writepage+0x68e/0x7b0
[ 4574.388570]  ? folio_clear_dirty_for_io+0x113/0x180
[ 4574.388574]  write_cache_pages+0x168/0x350
[ 4574.388576]  ? bch2_readpages_end_io+0x240/0x240
[ 4574.388579]  bch2_writepages+0x57/0xb0
[ 4574.388583]  do_writepages+0xba/0x180
[ 4574.388586]  __writeback_single_inode+0x2a/0x190
[ 4574.388588]  writeback_sb_inodes+0x1d2/0x420
[ 4574.388591]  __writeback_inodes_wb+0x47/0xd0
[ 4574.388593]  wb_writeback.isra.0+0x150/0x1a0
[ 4574.388596]  wb_workfn+0x269/0x370
[ 4574.388598]  ? __schedule+0x2cd/0x11c0
[ 4574.388600]  ? drm_sched_job_cleanup+0xd3/0x120
[ 4574.388604]  process_one_work+0x12d/0x240
[ 4574.388609]  worker_thread+0x2e8/0x400
Quoted 8 lines
[ 4574.388612]  ? rescuer_thread+0x3f0/0x3f0
[ 4574.388615]  kthread+0xcb/0xf0
[ 4574.388619]  ? kthread_complete_and_exit+0x20/0x20
[ 4574.388622]  ret_from_fork+0x2f/0x50
[ 4574.388625]  ? kthread_complete_and_exit+0x20/0x20
[ 4574.388628]  ret_from_fork_asm+0x11/0x20
[ 4574.388631]  </TASK>
[ 4574.388633] ---[ end trace 0000000000000000 ]---

Turns out, bch_folio_sector was 4 bytes, not 2, causing us to exceed the 8k limit. Thanks, fix will be out soon.