Messages in this thread |  | | Date | Fri, 25 Jan 2019 15:32:30 +0100 | | From | Michal Hocko <> | | Subject | Re: [PATCH v7 3/3] mm: Maintain randomization of page free lists |
| |
On Mon 07-01-19 15:21:21, Dan Williams wrote: > When freeing a page with an order >= shuffle_page_order randomly select > the front or back of the list for insertion. > > While the mm tries to defragment physical pages into huge pages this can > tend to make the page allocator more predictable over time. Inject the > front-back randomness to preserve the initial randomness established by > shuffle_free_memory() when the kernel was booted. > > The overhead of this manipulation is constrained by only being applied > for MAX_ORDER sized pages by default. > > Cc: Michal Hocko <mhocko@suse.com> > Cc: Kees Cook <keescook@chromium.org> > Cc: Dave Hansen <dave.hansen@linux.intel.com> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> > --- > include/linux/mmzone.h | 10 ++++++++++ > include/linux/shuffle.h | 12 ++++++++++++ > mm/page_alloc.c | 11 +++++++++-- > mm/shuffle.c | 16 ++++++++++++++++ > 4 files changed, 47 insertions(+), 2 deletions(-) > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index b78a45e0b11c..c15f7f703be0 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -98,6 +98,8 @@ extern int page_group_by_mobility_disabled; > struct free_area { > struct list_head free_list[MIGRATE_TYPES]; > unsigned long nr_free; > + u64 rand; > + u8 rand_bits; > };
Do we really need per order randomness? Why a global one is not sufficient? -- Michal Hocko SUSE Labs
|  |