Re: Re: PG_reserved and compound pages

From: Frank Mehnert
Date: Wed Apr 06 2016 - 11:13:02 EST


Hi Michal,

On Wednesday 06 April 2016 17:02:06 Michal Hocko wrote:
> [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?

No, we do nothing like that. It was my understanding that at least with
older kernels it was possible that pages allocated with alloc_pages()
could be swapped out or otherwise manipulated, I might be wrong. For
instance, it's also necessary that the physical address of the page
is known and that it does never change. I know, there might be problems
with automatic NUMA page migration but that's another story.

> > 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?

Frank
--
Dr.-Ing. Frank Mehnert | Software Development Director, VirtualBox
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: RiesstraÃe 25, D-80992 MÃnchen
Registergericht: Amtsgericht MÃnchen, HRA 95603

KomplementÃrin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
GeschÃftsfÃhrer: Alexander van der Ven, Jan Schultheiss, Val Maher