Skip to content

Commit 902c990

Browse files
mm: Call folio_mapping() inside folio_needs_release()
We must call folio_mapping() inside folio_needs_release() or we will end up oopsing on an anon page as follows: RIP: 0010:filemap_release_folio+0x69/0x80 Code: 75 95 00 5d e9 58 7c 95 00 48 85 d2 74 f5 48 8b 8a 98 00 00 00 84 c9 79 ea 48 8b 0f 31 c0 80 e5 80 75 e0 48 8b 82 90 00 00 00 <48> 8b 40 48 48 85 c0 75 cb e8 19 69 15 00 5d e9 23 7c 95 00 0f 0b RSP: 0018:ffffa89c4057b980 EFLAGS: 00010246 RAX: 0500000001251880 RBX: ffffa89c4057baa8 RCX: 0017ffffc0080005 RDX: ffff90c709bd3f71 RSI: 0000000000000cc0 RDI: ffffebcf45a6e800 RBP: ffffa89c4057b980 R08: ffff90c707f800c0 R09: ffffebcf45a6e808 R10: 0000000000000000 R11: 000000000000000c R12: ffffebcf45a6e800 R13: ffffa89c4057ba08 R14: ffffebcf45a6e808 R15: ffffa89c4057bdb0 FS: 0000000000000000(0000) GS:ffff91443fdc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f4472634000 CR3: 0000000103d8a000 CR4: 0000000000350ee0 Call Trace: <TASK> shrink_folio_list+0x746/0xc80 evict_folios+0x272/0x5f0 try_to_shrink_lruvec+0x1f1/0x2d0 shrink_one+0x13b/0x1b0 lru_gen_shrink_node+0x1ee/0x3e0 shrink_node+0x68d/0x730 balance_pgdat+0x41e/0x8c0 kswapd+0x1f4/0x3b0 kthread+0xf9/0x130 ret_from_fork+0x2c/0x50 </TASK> Reported-by: Daire Byrne <daire.byrne@gmail.com> Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
1 parent a7577d3 commit 902c990

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static inline void set_page_refcounted(struct page *page)
175175
*/
176176
static inline bool folio_needs_release(struct folio *folio)
177177
{
178-
struct address_space *mapping = folio->mapping;
178+
struct address_space *mapping = folio_mapping(folio);
179179

180180
return folio_has_private(folio) ||
181181
(mapping && mapping_release_always(mapping));

0 commit comments

Comments
 (0)