title: Why __GFP_HIGHMEM flag can't be applied to the __get_free_page() or kmalloc()
body: <p>I want to know basically the two things</p>
  
  <ol>
  <li>How does the kmalloc works i mean which function kmalloc calls to allocate memory is it alloc_pages() or __ger_free_pages().</li>
  <li>Why Why __GFP_HIGHMEM flag can't be applied to the __get_free_page() or kmalloc()</li>
  </ol>
  
  <p>I got the folowing extract from the LKD Robert Love can any body better explain that what is exact probelm with the alloc_pages() while giving __GFP_HIGHMEM flag.</p>
  
  <p>Page # 240 CHAPTER 12</p>
  
  <blockquote>
    <p>You cannot specify __GFP_HIGHMEM to either __get_free_pages() or
    kmalloc(). Because these both return a logical address, and not a page
    structure, it is possible that these functions would allocate memory
    not currently mapped in the kernel’s virtual address space and, thus,
    does not have a logical address. Only alloc_pages() can allocate high
    memory.The majority of your allocations, however, will not specify a
    zone modifier because ZONE_NORMAL is sufficient.</p>
  </blockquote>