On Mon, Nov 09, 2015 at 12:30:08PM -0800, Dave Hansen wrote: > On 11/09/2015 11:52 AM, Matthew Wilcox wrote: > > On Sun, Nov 08, 2015 at 02:27:39PM -0500, Dan Williams wrote: > >> As Dave points out when dealing with the contents of a page we use > >> PAGE_SIZE and PAGE_SHIFT, similary for huge pages use HPAGE_SIZE and > >> HPAGE_SHIFT. > > > > Hang on, no. We want to use PMD_SIZE here so that when we add PGD_SIZE > > support, it's all nicely symmetrical. > > This is splitting hairs a bit, but here goes. > > Do we care about the pagetables, or do we care about the page sizes? > > If we are doing pagetable things, we use P{TE,MD,UD,GD}_SIZE. If we are > doing something related to page (contents) themselves, we use > H?PAGE_SIZE. This makes it clear whether we're dealing with pagetables, > or *contents*. > > In the end, they're the same thing on our architecture at the moment, so > it matters very little. Agreed we're splitting hairs here but I'm not sure why the hair can be split :-) We come here from the page fault handler, where we've discovered that there is no page table for a PMD-shaped hole in the address space, and we'd like a PMD inserted by the fault handler. In that sense, we care about PMD_SIZE. Another problem is that the name 'HPAGE' doesn't obviously say "I cover a PMD-sized hole" -- hugetlbfs can use 1GB pages as well as 2MB pages. Then there's the problem that there *is* no equivalent to HPAGE for PUDs or PGDs -- if PMDs are "huge", then what are the names for pages pointed to by PUDs and PGDs? Why is it important to distinguish between "the size of something pointed to by a PMD" and "the size of the contents"? Actually, I'm not sure I even understand how to summarise the distinction. -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html