From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Paul Mackerras <paulus@samba.org>,
Ben Herrenschmidt <benh@kernel.crashing.org>,
Paul Mundt <lethal@linux-sh.org>, Dave Airlie <airlied@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 11/15] mm: long page counts
Date: Thu, 10 Nov 2005 02:00:21 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.61.0511100157560.5814@goblin.wat.veritas.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0511100139550.5814@goblin.wat.veritas.com>
The type of the page_count and page_mapcount functions has changed from
int to long. Update those places which give warnings (mostly debug
printks), or where the count might significantly overflow.
Don't bother with the arch's show_mem functions for now (some say int
shared, some long): they don't cause warnings, the truncation wouldn't
matter much, and we'll want to visit them all (perhaps bring them into
common code) in a later phase of PageReserved removal.
The thought of page_referenced on a page whose mapcount exceeds an int
is rather disturbing: it should probably skip high mapcounts unless the
memory pressure is high; but that's a different problem, ignore for now.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
arch/ppc64/kernel/vdso.c | 6 +++---
arch/sh64/lib/dbg.c | 2 +-
drivers/char/drm/drm_vm.c | 2 +-
fs/proc/task_mmu.c | 2 +-
mm/page_alloc.c | 2 +-
mm/rmap.c | 18 +++++++++---------
mm/swapfile.c | 2 +-
7 files changed, 17 insertions(+), 17 deletions(-)
--- mm10/arch/ppc64/kernel/vdso.c 2005-11-07 07:39:07.000000000 +0000
+++ mm11/arch/ppc64/kernel/vdso.c 2005-11-09 14:40:00.000000000 +0000
@@ -112,11 +112,11 @@ struct lib64_elfinfo
#ifdef __DEBUG
static void dump_one_vdso_page(struct page *pg, struct page *upg)
{
- printk("kpg: %p (c:%d,f:%08lx)", __va(page_to_pfn(pg) << PAGE_SHIFT),
+ printk("kpg: %p (c:%ld,f:%08lx)", __va(page_to_pfn(pg) << PAGE_SHIFT),
page_count(pg),
pg->flags);
if (upg/* && pg != upg*/) {
- printk(" upg: %p (c:%d,f:%08lx)", __va(page_to_pfn(upg) << PAGE_SHIFT),
+ printk(" upg: %p (c:%ld,f:%08lx)", __va(page_to_pfn(upg) << PAGE_SHIFT),
page_count(upg),
upg->flags);
}
@@ -184,7 +184,7 @@ static struct page * vdso_vma_nopage(str
pg = virt_to_page(vbase + offset);
get_page(pg);
- DBG(" ->page count: %d\n", page_count(pg));
+ DBG(" ->page count: %ld\n", page_count(pg));
return pg;
}
--- mm10/arch/sh64/lib/dbg.c 2005-06-17 20:48:29.000000000 +0100
+++ mm11/arch/sh64/lib/dbg.c 2005-11-09 14:40:00.000000000 +0000
@@ -422,7 +422,7 @@ unsigned long lookup_itlb(unsigned long
void print_page(struct page *page)
{
- printk(" page[%p] -> index 0x%lx, count 0x%x, flags 0x%lx\n",
+ printk(" page[%p] -> index 0x%lx, count 0x%lx, flags 0x%lx\n",
page, page->index, page_count(page), page->flags);
printk(" address_space = %p, pages =%ld\n", page->mapping,
page->mapping->nrpages);
--- mm10/drivers/char/drm/drm_vm.c 2005-11-07 07:39:15.000000000 +0000
+++ mm11/drivers/char/drm/drm_vm.c 2005-11-09 14:40:00.000000000 +0000
@@ -112,7 +112,7 @@ static __inline__ struct page *drm_do_vm
get_page(page);
DRM_DEBUG
- ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n",
+ ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%ld\n",
baddr, __va(agpmem->memory->memory[offset]), offset,
page_count(page));
--- mm10/fs/proc/task_mmu.c 2005-11-07 07:39:46.000000000 +0000
+++ mm11/fs/proc/task_mmu.c 2005-11-09 14:40:00.000000000 +0000
@@ -422,7 +422,7 @@ static struct numa_maps *get_numa_maps(c
for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) {
page = follow_page(mm, vaddr, 0);
if (page) {
- int count = page_mapcount(page);
+ long count = page_mapcount(page);
if (count)
md->mapped++;
--- mm10/mm/page_alloc.c 2005-11-09 14:38:03.000000000 +0000
+++ mm11/mm/page_alloc.c 2005-11-09 14:40:00.000000000 +0000
@@ -126,7 +126,7 @@ static void bad_page(const char *functio
{
printk(KERN_EMERG "Bad page state at %s (in process '%s', page %p)\n",
function, current->comm, page);
- printk(KERN_EMERG "flags:0x%0*lx mapping:%p mapcount:%d count:%d\n",
+ printk(KERN_EMERG "flags:0x%0*lx mapping:%p mapcount:%ld count:%ld\n",
(int)(2*sizeof(unsigned long)), (unsigned long)page->flags,
page->mapping, page_mapcount(page), page_count(page));
printk(KERN_EMERG "Backtrace:\n");
--- mm10/mm/rmap.c 2005-11-09 14:40:00.000000000 +0000
+++ mm11/mm/rmap.c 2005-11-09 14:40:00.000000000 +0000
@@ -64,12 +64,12 @@ static inline void validate_anon_vma(str
#ifdef RMAP_DEBUG
struct anon_vma *anon_vma = find_vma->anon_vma;
struct vm_area_struct *vma;
- unsigned int mapcount = 0;
+ unsigned int vmacount = 0;
int found = 0;
list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
- mapcount++;
- BUG_ON(mapcount > 100000);
+ vmacount++;
+ BUG_ON(vmacount > 100000);
if (vma == find_vma)
found = 1;
}
@@ -289,7 +289,7 @@ pte_t *page_check_address(struct page *p
* repeatedly from either page_referenced_anon or page_referenced_file.
*/
static int page_referenced_one(struct page *page,
- struct vm_area_struct *vma, unsigned int *mapcount, int ignore_token)
+ struct vm_area_struct *vma, long *mapcount, int ignore_token)
{
struct mm_struct *mm = vma->vm_mm;
unsigned long address;
@@ -322,7 +322,7 @@ out:
static int page_referenced_anon(struct page *page, int ignore_token)
{
- unsigned int mapcount;
+ long mapcount;
struct anon_vma *anon_vma;
struct vm_area_struct *vma;
int referenced = 0;
@@ -355,7 +355,7 @@ static int page_referenced_anon(struct p
*/
static int page_referenced_file(struct page *page, int ignore_token)
{
- unsigned int mapcount;
+ long mapcount;
struct address_space *mapping = page->mapping;
pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
struct vm_area_struct *vma;
@@ -600,7 +600,7 @@ out:
#define CLUSTER_MASK (~(CLUSTER_SIZE - 1))
static void try_to_unmap_cluster(unsigned long cursor,
- unsigned int *mapcount, struct vm_area_struct *vma)
+ long *mapcount, struct vm_area_struct *vma)
{
struct mm_struct *mm = vma->vm_mm;
pgd_t *pgd;
@@ -712,7 +712,7 @@ static int try_to_unmap_file(struct page
unsigned long cursor;
unsigned long max_nl_cursor = 0;
unsigned long max_nl_size = 0;
- unsigned int mapcount;
+ long mapcount;
spin_lock(&mapping->i_mmap_lock);
vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
@@ -768,7 +768,7 @@ static int try_to_unmap_file(struct page
try_to_unmap_cluster(cursor, &mapcount, vma);
cursor += CLUSTER_SIZE;
vma->vm_private_data = (void *) cursor;
- if ((int)mapcount <= 0)
+ if (mapcount <= 0)
goto out;
}
vma->vm_private_data = (void *) max_nl_cursor;
--- mm10/mm/swapfile.c 2005-11-09 14:38:03.000000000 +0000
+++ mm11/mm/swapfile.c 2005-11-09 14:40:00.000000000 +0000
@@ -308,7 +308,7 @@ static inline int page_swapcount(struct
*/
int can_share_swap_page(struct page *page)
{
- int count;
+ long count;
BUG_ON(!PageLocked(page));
count = page_mapcount(page);
next prev parent reply other threads:[~2005-11-10 2:01 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-10 1:42 [PATCH 00/15] mm: struct page lock and counts Hugh Dickins
2005-11-10 1:43 ` [PATCH 01/15] mm: poison struct page for ptlock Hugh Dickins
2005-11-10 2:10 ` Andrew Morton
2005-11-10 2:22 ` Hugh Dickins
2005-11-10 2:56 ` Andrew Morton
2005-11-10 2:58 ` Andrew Morton
2005-11-10 11:28 ` Ingo Molnar
2005-11-10 12:06 ` Ingo Molnar
2005-11-10 12:26 ` Andrew Morton
2005-11-10 21:37 ` Christoph Lameter
2005-11-10 21:52 ` Christoph Hellwig
2005-11-11 10:46 ` Ingo Molnar
2005-11-12 23:48 ` Adrian Bunk
2005-11-10 12:35 ` Hugh Dickins
2005-11-10 12:51 ` Andrew Morton
2005-11-10 13:29 ` Hugh Dickins
2005-11-10 15:00 ` Ingo Molnar
2005-11-10 15:38 ` Hugh Dickins
2005-11-10 19:49 ` Andrew Morton
2005-11-10 19:56 ` Linus Torvalds
2005-11-11 0:10 ` Russell King
2005-11-12 6:27 ` Benjamin Herrenschmidt
2005-11-11 15:02 ` Hugh Dickins
2005-11-15 18:49 ` Andrew Morton
2005-11-15 19:51 ` Hugh Dickins
2005-11-15 20:05 ` Andrew Morton
2005-11-10 1:44 ` [PATCH 02/15] mm: revert page_private Hugh Dickins
2005-11-10 1:46 ` [PATCH 03/15] mm reiser4: " Hugh Dickins
2005-11-10 1:47 ` [PATCH 04/15] mm: update split ptlock Kconfig Hugh Dickins
2005-11-10 1:48 ` [PATCH 05/15] mm: unbloat get_futex_key Hugh Dickins
2005-11-10 1:50 ` [PATCH 06/15] mm: remove ppc highpte Hugh Dickins
2005-11-10 1:52 ` Benjamin Herrenschmidt
2005-11-10 1:55 ` Paul Mackerras
2005-11-10 2:46 ` Hugh Dickins
2005-11-10 1:51 ` [PATCH 07/15] mm: powerpc ptlock comments Hugh Dickins
2005-11-10 1:53 ` [PATCH 08/15] mm: powerpc init_mm without ptlock Hugh Dickins
2005-11-10 1:56 ` [PATCH 09/15] mm: fill arch atomic64 gaps Hugh Dickins
2005-11-10 13:38 ` Andi Kleen
2005-11-10 15:19 ` Hugh Dickins
2005-11-10 1:57 ` [PATCH 10/15] mm: atomic64 page counts Hugh Dickins
2005-11-10 2:16 ` Andrew Morton
2005-11-10 2:33 ` Hugh Dickins
2005-11-10 3:01 ` Andrew Morton
2005-11-10 21:43 ` Christoph Lameter
2005-11-10 21:53 ` Andrew Morton
2005-11-11 15:25 ` Hugh Dickins
2005-11-11 18:03 ` Christoph Lameter
2005-11-10 2:00 ` Hugh Dickins [this message]
2005-11-10 2:01 ` [PATCH 12/15] mm reiser4: long " Hugh Dickins
2005-11-10 2:03 ` [PATCH 13/15] mm: get_user_pages check count Hugh Dickins
2005-11-10 2:08 ` [PATCH 14/15] mm: inc_page_table_pages check max Hugh Dickins
2005-11-10 2:09 ` [PATCH 15/15] mm: remove install_page limit Hugh Dickins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.61.0511100157560.5814@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=airlied@gmail.com \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®