From: NIIBE Y. <gn...@m1...> - 2001-08-09 06:20:47
|
Because there's possibility that it's not valid page, we should not access the member of the page when we check it is valid or not. This is a fix. If we have many nodes, this is not good implementation, but I think that we don't have many (two or so). Bug fix for dis-contiguous page handling. * include/asm-sh/mmzone.h (is_valid_page): New inline function. (VALID_PAGE): Use is_valid_page. Index: include/asm-sh/mmzone.h =================================================================== RCS file: /cvsroot/linuxsh/kernel/include/asm-sh/mmzone.h,v retrieving revision 1.2 diff -u -r1.2 mmzone.h --- include/asm-sh/mmzone.h 2001/07/15 23:26:56 1.2 +++ include/asm-sh/mmzone.h 2001/08/09 06:15:15 @@ -42,11 +42,18 @@ NODE_MEM_MAP(node) \ + (((phys) - NODE_DATA(node)->node_start_paddr) >> PAGE_SHIFT); }) -/* XXX: It's not safe to deref page->virtual... */ -#define VALID_PAGE(page) \ -({ unsigned int node = KVADDR_TO_NID(page_address(page)); \ - ((node < NR_NODES) && \ - ((unsigned)((page) - NODE_MEM_MAP(node)) < NODE_DATA(node)->node_size) ); \ -}) +static inline int is_valid_page(struct page *page) +{ + unsigned int i; + + for (i = 0; i < NR_NODES; i++) { + if (page >= NODE_MEM_MAP(i) && + page < NODE_MEM_MAP(i) + NODE_DATA(i)->node_size) + return 1; + } + return 0; +} + +#define VALID_PAGE(page) is_valid_page(page) #endif /* CONFIG_DISCONTIGMEM */ #endif -- |