Re: PG_reserved and compound pages

From: Michal Hocko
Date: Wed Apr 06 2016 - 11:02:14 EST


[CCing linux-mm mailing list]

On Wed 06-04-16 13:28:37, Frank Mehnert wrote:
> Hi,
>
> Linux 4.5 introduced additional checks to ensure that compound pages are
> never marked as reserved. In our code we use PG_reserved to ensure that
> the kernel does never swap out such pages, e.g.

Are you putting your pages on the LRU list? If not how they could get
swapped out?

>
> int i;
> struct page *pages = alloc_pages(GFP_HIGHUSER | __GFP_COMP, 4);
> for (i = 0; i < 16; i++)
> SetPageReserved(&pages[i]);
>
> The purpose of setting PG_reserved is to prevent the kernel from swapping
> this memory out. This worked with older kernel but not with Linux 4.5 as
> setting PG_reserved to compound pages is not allowed any more.
>
> Can somebody explain how we can achieve the same result in accordance to
> the new Linux 4.5 rules?
>
> Thanks,
>
> Frank
--
Michal Hocko
SUSE Labs