Pichai Raghavan wrote: > > Hi All, > > I was going thru the VM initialisation on my 2.4.2 kernel and had > the following doubts: > > (i) If alloc_page is called with HIGHMEM, then it allocates pages > from all of the 3 zones; for NORMAL it gets from NORMAL and DMA > and for DMA specifically from DMA. What is the logic behind this? The rationale is that we want to allow allocs to succeed as much as possible, so less-constrained allocs should be permitted to succeed from more-constrained zones. I had this same question when I was looking at the zone code, and I concluded that the allocator does not try hard enough to get pages from the proper zone - it's possible to alloc DMA pages on a GFP_HIGHMEM alloc, even when there are free pages in ZONE_HIGH. > If a certain zone is marked as DMA and if kernel is stealing pages > for normal allocation then won't it be unfair to device driver > that is expecting a DMA page? Yes, I think so, but that's the way it is. > (ii) The initialisation of zones happens in order DMA, NORMAL and > HIGHMEM. (struct zone_names etc...) Is there any reason why this > is being done? The kernel is assuming that pages marked for DMA > precedes the pages meant for NORMAL. On PC architectures, that's a hardware constraint: usually only the first physical 16MB of RAM are DMA-able. I don't know how this works on other architectures, though. > What happens if I change this > order? I suspect you'd find a lot of device drivers would be unable to utilize DMA. Cheers, -- Joe -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/