linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Inconsistency (bug) of vm_insert_page with high order allocations
@ 2009-05-28  5:07 Alexey Korolev
       [not found] ` <20090528143524.e8a2cde7.kamezawa.hiroyu@jp.fujitsu.com>
  2009-05-28  9:59 ` Mel Gorman
  0 siblings, 2 replies; 8+ messages in thread
From: Alexey Korolev @ 2009-05-28  5:07 UTC (permalink / raw)
  To: linux-mm; +Cc: greg, vijaykumar

Hi,
I have the following issue. I need to allocate a big chunk of
contiguous memory and then transfer it to user mode applications to
let them operate with given buffers.

To allocate memory I use standard function alloc_apges(gfp_mask,
order) which asks buddy allocator to give a chunk of memory of given
"order".
Allocator returns page and also sets page count to 1 but for page of
high order. I.e. pages 2,3 etc inside high order allocation will have
page->_count==0.
If I try to mmap allocated area to user space vm_insert_page will
return error as pages 2,3, etc are not refcounted.

The issue could be workaround if to set-up refcount to 1 manually for
each page. But this workaround is not very good, because page refcount
is used inside mm subsystem only.

While searching a driver with the similar solutions in kernel tree it
was found a driver which suffers from exactly the same
problem("poch"). So it is not single problem.

What you could suggest to workaround the problem except hacks with page count?
May be it makes sence to introduce wm_insert_pages function?

In this case users would have the following picture:
zero order page: alloc_page <-> vm_instert_page
non zero order  : alloc_pages(..., order) <-> vm_instert_pages(...., order)

Thanks,
Alexey

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2009-06-03 16:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-28  5:07 Inconsistency (bug) of vm_insert_page with high order allocations Alexey Korolev
     [not found] ` <20090528143524.e8a2cde7.kamezawa.hiroyu@jp.fujitsu.com>
2009-05-28  7:02   ` Alexey Korolev
     [not found]     ` <20090528162108.a6adcc36.kamezawa.hiroyu@jp.fujitsu.com>
2009-05-30  5:42       ` Alexey Korolev
2009-06-01 23:53         ` KAMEZAWA Hiroyuki
2009-05-28  9:59 ` Mel Gorman
2009-05-30  5:27   ` Alexey Korolev
2009-06-02  8:38     ` Mel Gorman
2009-06-03  5:58       ` Alexey Korolev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox