On Wed, Nov 21, 2012 at 02:07:04PM +0100, Michal Nazarewicz wrote:
On Wed, Nov 21 2012, Minchan Kim wrote:
So your concern is that too many free pages in MIGRATE_CMA when OOM happens is odd? It's natural with considering CMA design which kernel never fallback non-movable page allocation to CMA area. I guess it's not a your concern.
Let's think below extreme cases.
= Before =
- 1000M DRAM system.
- 400M kernel used pages.
- 300M movable used pages.
- 300M cma freed pages.
- kernel want to request 400M non-movable memory, additionally.
- VM start to reclaim 300M movable pages.
- But it's not enough to meet 400M request.
- go to OOM. (It's natural)
= After(with your patch) =
- 1000M DRAM system.
- 400M kernel used pages.
- 300M movable *freed* pages.
- 300M cma used pages(by your patch, I simplified your concept)
- kernel want to request 400M non-movable memory.
- 300M movable freed pages isn't enough to meet 400M request.
- Also, there is no point to reclaim CMA pages for non-movable allocation.
- go to OOM. (It's natural)
There is no difference between before and after in allocation POV. Let's think another example.
= Before =
- 1000M DRAM system.
- 400M kernel used pages.
- 300M movable used pages.
- 300M cma freed pages.
- kernel want to request 300M non-movable memory.
- VM start to reclaim 300M movable pages.
- It's enough to meet 300M request.
- happy end
= After(with your patch) =
- 1000M DRAM system.
- 400M kernel used pages.
- 300M movable *freed* pages.
- 300M cma used pages(by your patch, I simplified your concept)
- kernel want to request 300M non-movable memory.
- 300M movable freed pages is enough to meet 300M request.
- happy end.
There is no difference in allocation POV, too.
The difference thou is that before 30% of memory is wasted (ie. free), whereas after all memory is used. The main point of CMA is to make the memory useful if devices are not using it. Having it not allocated is defeating that purpose.
I think it's not a waste because if reclaimed movable pages is working set, they are soon reloaded to migrate_cma in this time.
-- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' ,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--