From: "Javier Cabezas Rodríguez" <jcabezas@ac.upc.edu>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: linux-mm@kvack.org
Subject: Re: Selective swap out of processes
Date: Wed, 29 Aug 2007 12:37:07 +0200 [thread overview]
Message-ID: <1188383827.11270.36.camel@bastion-laptop> (raw)
In-Reply-To: <46D4DBF7.7060102@yahoo.com.au>
[-- Attachment #1: Type: text/plain, Size: 2362 bytes --]
El mié, 29-08-2007 a las 12:37 +1000, Nick Piggin escribió:
> Simplest will be just to set referenced to 0 right after calling
> page_referenced, in the case you want to forcefully swap out the
> page.
>
> try_to_unmap will get called later in the same function.
I have tried this solution, but 0 pages are freed...
- RO/EXEC pages mapped from the executable are now skipped due to this
check:
if (!mapping || !remove_mapping(mapping, page))
goto keep_locked;
The offender is this check in remove_mapping:
if (unlikely(page_count(page) != 2))
goto cannot_free;
- RW pages mapped from the executable are skipped because pageout
returns PAGE_KEEP.
- Other pages are skipped because try_to_unmap returns SWAP_FAIL.
I also added a call ptep_clear_flush_young for each pte, to satisfy this
check in try_to_unmap_one:
if (!migration && ((vma->vm_flags & VM_LOCKED) ||
(ptep_clear_flush_young(vma, address, pte)))) {
ret = SWAP_FAIL;
goto out_unmap;
}
My code calls the following function for each VMA of the process. Are
there errors in the function?:
int my_free_pages(struct vm_area_struct * vma, struct mm_struct * mm)
{
LIST_HEAD(page_list);
unsigned long nr_taken;
struct zone * zone = NULL;
int ret;
pte_t *pte_k;
pud_t *pud;
pmd_t *pmd;
unsigned long addr;
struct page * p;
struct scan_control sc;
sc.gfp_mask = __GFP_FS;
sc.may_swap = 1;
sc.may_writepage = 1;
for (addr = vma->vm_start, nr_taken = 0; addr < vma->vm_end; addr +=
PAGE_SIZE, nr_taken++) {
pgd_t *pgd = pgd_offset(mm, addr);
if (pgd_none(*pgd))
return;
pud = pud_offset(pgd, addr);
if (pud_none(*pud))
return;
pmd = pmd_offset(pud, addr);
if (pmd_none(*pmd))
return;
if (pmd_large(*pmd))
pte_k = (pte_t *)pmd;
else
pte_k = pte_offset_kernel(pmd, addr);
if (pte_k && pte_present(*pte_k)) {
p = pte_page(*pte_k);
if (!zone)
zone = page_zone(p);
ptep_clear_flush_young(vma, addr, pte_k);
del_page_from_lru(zone, p);
list_add(&p->lru, &page_list);
}
}
spin_lock_irq(&zone->lru_lock);
__mod_zone_page_state(zone, NR_INACTIVE, -nr_taken);
zone->pages_scanned += nr_taken;
spin_unlock_irq(&zone->lru_lock);
}
Thanks
Javi
--
Javier Cabezas Rodríguez
Phd. Student - DAC (UPC)
jcabezas@ac.upc.edu
[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-08-29 10:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-28 16:54 Javier Cabezas Rodríguez
2007-08-29 2:37 ` Nick Piggin
2007-08-29 10:37 ` Javier Cabezas Rodríguez [this message]
2007-08-29 18:06 ` Javier Cabezas Rodríguez
2007-08-29 22:01 ` Dave Hansen
2007-08-30 7:13 ` Nick Piggin
2007-08-30 23:41 ` Javier Cabezas Rodríguez
2007-08-30 23:47 ` Javier Cabezas Rodríguez
2007-08-30 23:50 ` Javier Cabezas Rodríguez
2007-08-31 0:34 ` Nick Piggin
2007-08-31 16:40 ` Dave Hansen
2007-09-08 1:45 ` Nick Piggin
2007-08-30 7:09 ` Nick Piggin
2007-08-29 5:18 ` Christoph Lameter
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=1188383827.11270.36.camel@bastion-laptop \
--to=jcabezas@ac.upc.edu \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
/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