architecture problems with SPARSEMEM and page iteration functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A cursory grep indicates the architectures which may be affected by this
bug are:

arm, avr32, m32r, microblaze, mips, powerpc, s390, sparc, x86

The problem is the assumption that if you have a piece of contiguous
physical memory, you can iterate over it by starting with the first
struct page *page and doing page++.

The page++ trick works with FLATMEM and DISCONTIGMEM, but not SPARSEMEM.
The reason is that the SPARSEMEM section arrays have arbitrary power of
2 boundaries, so you can end up with physically adjacent pieces of
memory which are in different section arrays, meaning that page++
doesn't work, because it doesn't move from the end of the old section
array to the beginning of the new one.

The fix is to iterate by means of the pfn instead (the pfn_to_page()
functions do the right thing with respect to the section arrays) or
simply replace

page++

with

page = pfn_to_page(page_to_pfn(page) + 1);

A large number of the architectures seem to pick up the problem through
huge pages, so I note that as long as your SECTION_SIZE_BITS is large
enough (i.e. huge page size < 1 << (SECTION_SIZE_BITS + PAGE_SIZE)) you
should be OK.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux