Skip to content

RFC mm: shrink_all_memory improvements

Rafael J. Wysocki lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm: make shrink_all_memory overflow-resistantinclude/linux/swap.h mm/vmscan.c+6 -56 replies
2/2mm: make shrink_all_memory try hardermm/vmscan.c+15 -74 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC][PATCH -mm 0/2] mm: shrink_all_memory improvements

Hi,

The following two patches are designed to improve the shrink_all_memory() function used by swsusp and other pm functions.

The first patch makes shrink_all_memory() overflow-resistant. The problem is that, AFAICT, balance_pgdat(pgdat, nr_to_free, 0) may free more than nr_to_free pages, in which case nr_to_free, being unsigned, will overflow (and obviously it cannot be less than 0). Also if the argument is too big, strange things may happen.

The first patch adds a workaround of the problem that shrink_all_memory() may return 0 even if there still are some pages to free. WIth this patch applied it sometimes frees 2 times as many pages as without it on my box.

Please have a look and comment.

Greetings,
Rafael

Signature · 1 line
Beer is proof that God loves us and wants us to be happy - Benjamin Franklin