History

mm, page_alloc: always use a captured page regardless of compaction result

During the development of commit 5e1f0f098b46 ("mm, compaction: capture a page under direct compaction"), a paranoid check was added to ensure that if a captured page was available after compaction that it was consistent with the final state of compaction. The intent was to catch serious programming bugs such as using a stale page pointer and causing corruption problems. However, it is possible to get a captured page even if compaction was unsuccessful if an interrupt triggered and happened to free pages in interrupt context that got merged into a suitable high-order page. It's highly unlikely but Li Wang did report the following warning on s390 occuring when testing OOM handling. Note that the warning is slightly edited for clarity. WARNING: CPU: 0 PID: 9783 at mm/page_alloc.c:3777 __alloc_pages_direct_compact+0x182/0x190 Modules linked in: rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache sunrpc pkey ghash_s390 prng xts aes_s390 des_s390 des_generic sha512_s390 zcrypt_cex4 zcrypt vmur binfmt_misc ip_tables xfs libcrc32c dasd_fba_mod qeth_l2 dasd_eckd_mod dasd_mod qeth qdio lcs ctcm ccwgroup fsm dm_mirror dm_region_hash dm_log dm_mod CPU: 0 PID: 9783 Comm: copy.sh Kdump: loaded Not tainted 5.1.0-rc 5 #1 This patch simply removes the check entirely instead of trying to be clever about pages freed from interrupt context. If a serious programming error was introduced, it is highly likely to be caught by prep_new_page() instead.

Mel Gorman committed 7 years ago

Commit ee8ab0e1 parent 24512221 file · +0 −5Browse files

Unified · Split

mm/page_alloc.c+0−5
@@ -3786,11 +3786,6 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, · 3785 unmodified lines
3786 memalloc_noreclaim_restore(noreclaim_flag);3786 memalloc_noreclaim_restore(noreclaim_flag);
3787 psi_memstall_leave(&pflags);3787 psi_memstall_leave(&pflags);
3788 3788
3789 if (*compact_result <= COMPACT_INACTIVE) {
3790 WARN_ON_ONCE(page);
3791 return NULL;
3792 }
3793
3794 /*3789 /*
3795 * At least in one zone compaction wasn't deferred or skipped, so let's3790 * At least in one zone compaction wasn't deferred or skipped, so let's
3796 * count a compaction stall3791 * count a compaction stall

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t