Re: [PATCH 1/5] Make __pa() uses CPHYSADDR() if really needed

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

 



On Wed, 11 Oct 2006 18:01:43 +0200, Franck Bui-Huu <vagabon.xyz@xxxxxxxxx> wrote:
> > __pa() is used in many place indirectly via virt_to_page().
> 
> what about make virt_to_page() use virt_to_phys() instead ?

No objection for virt_to_phys(), but I found other __pa() usages in
kernel.

drivers/char/mem.c:       && addr >= __pa(high_memory);
drivers/char/mem.c:     return addr >= __pa(high_memory);
drivers/char/mem.c:     if (addr + count > __pa(high_memory))
drivers/char/mem.c:     pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT;

So __pa() should handle >512MB address unless we change all __pa() usages.

How about something like this ?

#if defined(CONFIG_64BITS) && !defined(CONFIG_BUILD_ELF64)
#define __pa(x)			((unsigned long)(x) - ((unsigned long)(x) >= CKSEG0 ? CKSEG0 : PAGE_OFFSET))
#else
#define __pa(x)			((unsigned long)(x) - PAGE_OFFSET)
#endif

In any case, I think virt_to_page() should use simpler virt_to_phys()
for better performance.

---
Atsushi Nemoto


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux