linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: "Javier Cabezas Rodríguez" <jcabezas@ac.upc.edu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>, linux-mm@kvack.org
Subject: Re: Selective swap out of processes
Date: Wed, 29 Aug 2007 15:01:39 -0700	[thread overview]
Message-ID: <1188424899.28903.135.camel@localhost> (raw)
In-Reply-To: <1188410818.9682.2.camel@bastion-laptop>

I need the same basic thing for process checkpoint/restart.  I just have
a syscall to which I give a virtual address, and then have the kernel
try to swap it out.  It uses follow_page(FOLL_GET) and find_vma() in the
higher-level function, but this appears to work just fine.

I meant this as a horrible hack to play with a couple of months ago, but
it hasn't quite broken on me, yet.  


diff -puN mm/vmscan.c~ptrace-force-swap1 mm/vmscan.c
--- lxc/mm/vmscan.c~ptrace-force-swap1  2007-03-15 11:21:06.000000000 -0700
+++ lxc-dave/mm/vmscan.c        2007-03-15 13:03:57.000000000 -0700
@@ -614,6 +614,23 @@ static unsigned long shrink_page_list(st        return nr_reclaimed;    
 } 
 
+int try_to_put_page_in_swap(struct page *page)
+{
+
+       get_page(page);
+       if (page_count(page) == 1)
+                /* page was freed from under us. So we are done. */
+                return -EAGAIN;
+       lock_page(page);
+       if (PageWriteback(page))
+               wait_on_page_writeback(page);
+       try_to_unmap(page, 0);
+       //printk("page mapped: %d\n", page_mapped(page));
+       unlock_page(page);
+       put_page(page);
+       return 0;
+}      
+
 /*     
  * zone->lru_lock is heavily contended.  Some of the functions that
  * shrink the lists perform better by taking out a batch of pages

-- Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-08-29 22:01 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
2007-08-29 18:06     ` Javier Cabezas Rodríguez
2007-08-29 22:01       ` Dave Hansen [this message]
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=1188424899.28903.135.camel@localhost \
    --to=haveblue@us.ibm.com \
    --cc=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