Repository navigation
Commit ef4aede
committed
PM/Hibernate: Do not try to allocate too much memory too hard (rev. 2)
We want to avoid attempting to free too much memory too hard during
hibernation, so estimate the minimum size of the image to use as the
lower limit for preallocating memory.
The approach here is based on the (experimental) observation that we
can't free more page frames than the sum of:
* global_page_state(NR_SLAB_RECLAIMABLE)
* global_page_state(NR_ACTIVE_ANON)
* global_page_state(NR_INACTIVE_ANON)
* global_page_state(NR_ACTIVE_FILE)
* global_page_state(NR_INACTIVE_FILE)
minus
* global_page_state(NR_FILE_MAPPED)
Namely, if this number is subtracted from the number of saveable
pages in the system, we get a good estimate of the minimum reasonable
size of a hibernation image.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Wu Fengguang <fengguang.wu@intel.com>1 parent 64a473c commit ef4aede
1 file changed
Lines changed: 39 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1203 | 1203 | | |
1204 | 1204 | | |
1205 | 1205 | | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
1206 | 1236 | | |
1207 | 1237 | | |
1208 | 1238 | | |
| |||
1220 | 1250 | | |
1221 | 1251 | | |
1222 | 1252 | | |
1223 | | - | |
1224 | | - | |
| 1253 | + | |
| 1254 | + | |
1225 | 1255 | | |
1226 | 1256 | | |
1227 | 1257 | | |
| |||
1282 | 1312 | | |
1283 | 1313 | | |
1284 | 1314 | | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
1285 | 1320 | | |
1286 | 1321 | | |
1287 | 1322 | | |
| |||
1294 | 1329 | | |
1295 | 1330 | | |
1296 | 1331 | | |
1297 | | - | |
1298 | | - | |
| 1332 | + | |
| 1333 | + | |
1299 | 1334 | | |
1300 | 1335 | | |
1301 | 1336 | | |
| |||
0 commit comments