All of lore.kernel.org
 help / color / mirror / Atom feed
* Questions about the zoned page frame allocator and fix mapped addresses
@ 2015-03-30 14:55 Sunny Shah
  2015-03-30 17:16 ` Valdis.Kletnieks at vt.edu
  0 siblings, 1 reply; 3+ messages in thread
From: Sunny Shah @ 2015-03-30 14:55 UTC (permalink / raw)
  To: kernelnewbies

Hello,

I have few more questions from my reading of "Understanding the Linux
Kernel", chapter "Memory Management".


   - The book says, about releasing page frames to the per CPU cache - "no
   page frame is ever released to the cold cache: the kernel always assumes
   the freed page frame is hot with respect to the hardware cache". What is
   the reason for this decision ?
   - It is possible for a page to be in ZONE_NORMAL and yet have it's
   PG_reserved flag cleared. Is this correct ?
   - The function "fix_to_virt" for fix-mapped linear addresses does the
   following:

   return (0xfffff000UL - (idx << PAGE_SHIFT));

   Why are the upper 4096 bytes not used, and the addressing starts from
   the top of the virtual address space - 4096 ?
   - The book says "each fix-mapped linear address maps one page frame of
   the physical memory". Shouldn't it be "maps one *physical location* of
   memory" rather than one page frame ?
   - My understanding is that the kernel page table entries for addresses >
   896 MB would be empty and those addresses would be mapped using separate
   data structures used for temporary and permanent kernel mappings and
   non-contiguous page frame allocation. Is this wrong ?


Thanks,
Sunny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150330/ab997889/attachment.html 

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

* Questions about the zoned page frame allocator and fix mapped addresses
  2015-03-30 14:55 Questions about the zoned page frame allocator and fix mapped addresses Sunny Shah
@ 2015-03-30 17:16 ` Valdis.Kletnieks at vt.edu
  2015-04-01 15:54   ` Sunny Shah
  0 siblings, 1 reply; 3+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2015-03-30 17:16 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 30 Mar 2015 20:25:38 +0530, Sunny Shah said:

>    - The book says, about releasing page frames to the per CPU cache - "no
>    page frame is ever released to the cold cache: the kernel always assumes
>    the freed page frame is hot with respect to the hardware cache". What is
>    the reason for this decision ?

What can go wrong if the page is cold but the kernel assumes it's hot?

What can go wrong if the kernel assumes it's cold but it's actually hot?

(Hint - in which cases will it do a cache flush?  In which cases is a
cache flush needed? What happens in each case if the kernel guesses wrong?)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150330/c119fa55/attachment.bin 

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

* Questions about the zoned page frame allocator and fix mapped addresses
  2015-03-30 17:16 ` Valdis.Kletnieks at vt.edu
@ 2015-04-01 15:54   ` Sunny Shah
  0 siblings, 0 replies; 3+ messages in thread
From: Sunny Shah @ 2015-04-01 15:54 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Mar 30, 2015 at 10:46 PM, <Valdis.Kletnieks@vt.edu> wrote:

> On Mon, 30 Mar 2015 20:25:38 +0530, Sunny Shah said:
>
> >    - The book says, about releasing page frames to the per CPU cache -
> "no
> >    page frame is ever released to the cold cache: the kernel always
> assumes
> >    the freed page frame is hot with respect to the hardware cache". What
> is
> >    the reason for this decision ?
>
> What can go wrong if the page is cold but the kernel assumes it's hot?
>
> What can go wrong if the kernel assumes it's cold but it's actually hot?
>
> (Hint - in which cases will it do a cache flush?  In which cases is a
> cache flush needed? What happens in each case if the kernel guesses wrong?)
>

Here's my understanding:
- If a page is cold but kernel assumes it to be hot, a 'hot' allocation of
that page would need it to be loaded into the CPU cache which means a
little overhead.
- If a page is hot but kernel assumes it to be cold, a future 'hot'
allocation would eventually cause the invalidation of the CPU cache
location corresponding to that page. But, even if the page were assumed to
be hot, this might have anyway happened due to another page occupying the
same cache location.

This has confused me even more! I'm not sure if this is correct, but if it
is, wouldn't this mean treating hot pages as cold is better ?
I apologise for anything that I might be looking over or not thinking in
the right direction. Please feel free to rebuke.

Also, any help on my other questions would be greatly appreciated:

   - It is possible for a page to be in ZONE_NORMAL and yet have it's
   PG_reserved flag cleared. Is this correct ?
   - The function "fix_to_virt" for fix-mapped linear addresses does the
   following:

   return (0xfffff000UL - (idx << PAGE_SHIFT));

   Why are the upper 4096 bytes not used, and the addressing starts from
   the top of the virtual address space - 4096 ?
   - The book says "each fix-mapped linear address maps one page frame of
   the physical memory". Shouldn't it be "maps one*physical location* of
   memory" rather than one page frame ?
   - My understanding is that the kernel page table entries for addresses >
   896 MB would be empty and those addresses would be mapped using separate
   data structures used for temporary and permanent kernel mappings and
   non-contiguous page frame allocation. Is this wrong ?


Thanks,
Sunny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150401/49a28199/attachment.html 

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

end of thread, other threads:[~2015-04-01 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-30 14:55 Questions about the zoned page frame allocator and fix mapped addresses Sunny Shah
2015-03-30 17:16 ` Valdis.Kletnieks at vt.edu
2015-04-01 15:54   ` Sunny Shah

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.