linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: PageBlocks and Migrate Types
       [not found] <CACDBo57u+sgordDvFpTzJ=U4mT8uVz7ZovJ3qSZQCrhdYQTw0A@mail.gmail.com>
@ 2019-08-22 12:52 ` Michal Hocko
  2019-08-22 18:24   ` Pankaj Suryawanshi
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2019-08-22 12:52 UTC (permalink / raw)
  To: Pankaj Suryawanshi
  Cc: linux-kernel, linux-mm, Vlastimil Babka, pankaj.suryawanshi

On Wed 21-08-19 22:23:44, Pankaj Suryawanshi wrote:
> Hello,
> 
> 1. What are Pageblocks and migrate types(MIGRATE_CMA) in Linux memory ?

Pageblocks are a simple grouping of physically contiguous pages with
common set of flags. I haven't checked closely recently so I might
misremember but my recollection is that only the migrate type is stored
there. Normally we would store that information into page flags but
there is not enough room there.

MIGRATE_CMA represent pages allocated for the CMA allocator. There are
other migrate types denoting unmovable/movable allocations or pages that
are isolated from the page allocator.

Very broadly speaking, the migrate type groups pages with similar
movability properties to reduce fragmentation that compaction cannot
do anything about because there are objects of different properties
around. Please note that pageblock might contain objects of a different
migrate type in some cases (e.g. low on memory).

Have a look at gfpflags_to_migratetype and how the gfp mask is converted
to a migratetype for the allocation. Also follow different MIGRATE_$TYPE
to see how it is used in the code.

> How many movable/unmovable pages are defined by default?

There is nothing like that. It depends on how many objects of a specific
type are allocated.

HTH
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PageBlocks and Migrate Types
  2019-08-22 12:52 ` PageBlocks and Migrate Types Michal Hocko
@ 2019-08-22 18:24   ` Pankaj Suryawanshi
  2019-08-26  7:04     ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Pankaj Suryawanshi @ 2019-08-22 18:24 UTC (permalink / raw)
  To: Michal Hocko; +Cc: linux-kernel, linux-mm, Vlastimil Babka, pankaj.suryawanshi

On Thu, Aug 22, 2019 at 6:22 PM Michal Hocko <mhocko@kernel.org> wrote:
>
> On Wed 21-08-19 22:23:44, Pankaj Suryawanshi wrote:
> > Hello,
> >
> > 1. What are Pageblocks and migrate types(MIGRATE_CMA) in Linux memory ?
>
> Pageblocks are a simple grouping of physically contiguous pages with
> common set of flags. I haven't checked closely recently so I might
> misremember but my recollection is that only the migrate type is stored
> there. Normally we would store that information into page flags but
> there is not enough room there.
>
> MIGRATE_CMA represent pages allocated for the CMA allocator. There are
> other migrate types denoting unmovable/movable allocations or pages that
> are isolated from the page allocator.
>
> Very broadly speaking, the migrate type groups pages with similar
> movability properties to reduce fragmentation that compaction cannot
> do anything about because there are objects of different properti
> around. Please note that pageblock might contain objects of a different
> migrate type in some cases (e.g. low on memory).
>
> Have a look at gfpflags_to_migratetype and how the gfp mask is converted
> to a migratetype for the allocation. Also follow different MIGRATE_$TYPE
> to see how it is used in the code.
>
> > How many movable/unmovable pages are defined by default?
>
> There is nothing like that. It depends on how many objects of a specific
> type are allocated.


It means that it started creating pageblocks after allocation of
different objects, but from which block it allocate initially when
there is nothing like pageblocks ? (when memory subsystem up)

Pageblocks and its type dynamically changes ?
>
>
> HTH
> --
> Michal Hocko
> SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PageBlocks and Migrate Types
  2019-08-22 18:24   ` Pankaj Suryawanshi
@ 2019-08-26  7:04     ` Michal Hocko
       [not found]       ` <CACDBo555_pxZjixThUZcqnADVVcmH1Qtfrr5H-2AR12L0=Rx3A@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Hocko @ 2019-08-26  7:04 UTC (permalink / raw)
  To: Pankaj Suryawanshi
  Cc: linux-kernel, linux-mm, Vlastimil Babka, pankaj.suryawanshi

On Thu 22-08-19 23:54:19, Pankaj Suryawanshi wrote:
> On Thu, Aug 22, 2019 at 6:22 PM Michal Hocko <mhocko@kernel.org> wrote:
> >
> > On Wed 21-08-19 22:23:44, Pankaj Suryawanshi wrote:
> > > Hello,
> > >
> > > 1. What are Pageblocks and migrate types(MIGRATE_CMA) in Linux memory ?
> >
> > Pageblocks are a simple grouping of physically contiguous pages with
> > common set of flags. I haven't checked closely recently so I might
> > misremember but my recollection is that only the migrate type is stored
> > there. Normally we would store that information into page flags but
> > there is not enough room there.
> >
> > MIGRATE_CMA represent pages allocated for the CMA allocator. There are
> > other migrate types denoting unmovable/movable allocations or pages that
> > are isolated from the page allocator.
> >
> > Very broadly speaking, the migrate type groups pages with similar
> > movability properties to reduce fragmentation that compaction cannot
> > do anything about because there are objects of different properti
> > around. Please note that pageblock might contain objects of a different
> > migrate type in some cases (e.g. low on memory).
> >
> > Have a look at gfpflags_to_migratetype and how the gfp mask is converted
> > to a migratetype for the allocation. Also follow different MIGRATE_$TYPE
> > to see how it is used in the code.
> >
> > > How many movable/unmovable pages are defined by default?
> >
> > There is nothing like that. It depends on how many objects of a specific
> > type are allocated.
> 
> 
> It means that it started creating pageblocks after allocation of
> different objects, but from which block it allocate initially when
> there is nothing like pageblocks ? (when memory subsystem up)

Pageblocks are just a way to group physically contiguous pages. They
just exist along with the physically contiguous memory. The migrate type
for most of the memory is set to MIGRATE_MOVABLE. Portion of the memory
might be reserved by CMA then that memory has MIGRATE_CMA. Following
set_pageblock_migratetype call paths will give you a good picture. 

> Pageblocks and its type dynamically changes ?

Yes as the purpose of the underlying memory for the block changes.
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PageBlocks and Migrate Types
       [not found]       ` <CACDBo555_pxZjixThUZcqnADVVcmH1Qtfrr5H-2AR12L0=Rx3A@mail.gmail.com>
@ 2019-08-27  5:43         ` Michal Hocko
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2019-08-27  5:43 UTC (permalink / raw)
  To: Pankaj Suryawanshi
  Cc: linux-kernel, linux-mm, Vlastimil Babka, pankaj.suryawanshi

On Mon 26-08-19 22:35:08, Pankaj Suryawanshi wrote:
> On Mon, Aug 26, 2019 at 12:34 PM Michal Hocko <mhocko@kernel.org> wrote:
> >
> > On Thu 22-08-19 23:54:19, Pankaj Suryawanshi wrote:
> > > On Thu, Aug 22, 2019 at 6:22 PM Michal Hocko <mhocko@kernel.org> wrote:
> > > >
> > > > On Wed 21-08-19 22:23:44, Pankaj Suryawanshi wrote:
> > > > > Hello,
> > > > >
> > > > > 1. What are Pageblocks and migrate types(MIGRATE_CMA) in Linux
> memory ?
> > > >
> > > > Pageblocks are a simple grouping of physically contiguous pages with
> > > > common set of flags. I haven't checked closely recently so I might
> > > > misremember but my recollection is that only the migrate type is
> stored
> > > > there. Normally we would store that information into page flags but
> > > > there is not enough room there.
> > > >
> > > > MIGRATE_CMA represent pages allocated for the CMA allocator. There are
> > > > other migrate types denoting unmovable/movable allocations or pages
> that
> > > > are isolated from the page allocator.
> > > >
> > > > Very broadly speaking, the migrate type groups pages with similar
> > > > movability properties to reduce fragmentation that compaction cannot
> > > > do anything about because there are objects of different properti
> > > > around. Please note that pageblock might contain objects of a
> different
> > > > migrate type in some cases (e.g. low on memory).
> > > >
> > > > Have a look at gfpflags_to_migratetype and how the gfp mask is
> converted
> > > > to a migratetype for the allocation. Also follow different
> MIGRATE_$TYPE
> > > > to see how it is used in the code.
> > > >
> > > > > How many movable/unmovable pages are defined by default?
> > > >
> > > > There is nothing like that. It depends on how many objects of a
> specific
> > > > type are allocated.
> > >
> > >
> > > It means that it started creating pageblocks after allocation of
> > > different objects, but from which block it allocate initially when
> > > there is nothing like pageblocks ? (when memory subsystem up)
> >
> > Pageblocks are just a way to group physically contiguous pages. They
> > just exist along with the physically contiguous memory. The migrate type
> > for most of the memory is set to MIGRATE_MOVABLE. Portion of the memory
> > might be reserved by CMA then that memory has MIGRATE_CMA. Following
> > set_pageblock_migratetype call paths will give you a good picture.
> 
> it means if i have 4096 continuous pages = 1 pageblock
> then all the 4096 pages of same type. but if any one page is different than
> block type then ? it changed the block type or something else ?

That really depends on the specific migrate type. CMA, ISOLATE migrate
types are all or nothing IIRC. I would have to check the code to tell
exactly when MOVABLE/UNMOVABLE pageblocks transitions are done.
steal_suitable_fallback sounds like a good start to look at.
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-27  5:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CACDBo57u+sgordDvFpTzJ=U4mT8uVz7ZovJ3qSZQCrhdYQTw0A@mail.gmail.com>
2019-08-22 12:52 ` PageBlocks and Migrate Types Michal Hocko
2019-08-22 18:24   ` Pankaj Suryawanshi
2019-08-26  7:04     ` Michal Hocko
     [not found]       ` <CACDBo555_pxZjixThUZcqnADVVcmH1Qtfrr5H-2AR12L0=Rx3A@mail.gmail.com>
2019-08-27  5:43         ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).