LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-07-2013, 04:44 AM   #1
ehabababneh
LQ Newbie
 
Registered: Apr 2009
Posts: 15

Rep: Reputation: Disabled
Explanation of writepage/readpage in Linux swapping.


Hello there,

I need to understand how swapped out dirty pages are written to block devices (specifically swap partition in a hard drive). where is the code that actually does that?

To make myself even clearer: I need to fill in the gap in the the sequence of function calls when reading a page as a result of page fault handling...

do_page_fault -> __do_page_fault -> handle_mm_fault -> handle_pte_fault -> do_swap_page -> swapin_readahead -> read_swap_cache_async -> swap_readpage -> ???? -> (read from disk)

also, I need to know how the page is actually read from the disk ... for example, what is exactly read from the disk? is it only the page content? or is there also some other meta data that is read as well?

* misc info: arch = amd64, Linux version = 3.X, backing store for swap is a Linux Swap partition (do not care about files or anything else).


I would love also to know the sequence of function calls for writing a dirty page as well...in a similar fashion to the above. I have read the Linux documentation and I have a good idea how the memory is managed (active/inactive lists, kswapd..etc.).

My end goal is to add support to additional types of storage devices for swapping. For example, assume I would like to swap pages out to/swap in pages from other types of storage media.

Thanks.
 
Old 06-08-2013, 05:47 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,311
Blog Entries: 28

Rep: Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137
I don't know enough to begin to answer your question, but the Interactive Kernel Map might be a good place to start.

Look in the column labeled "Storage."
 
Old 06-09-2013, 03:56 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Since before the 2.6 kernel stream the "swap" was changed to use standard disk pdflush/bdi facilities. This was when the different performance between a swap on partition and swap as a file disappeared.

So long as a block device driver exists to manage the device, I wouldn't expect you have to do anything. If mkswap and swapon are happy to talk to your device, I can't see why kswapd would care.
(all supposition - I started looking at swap management years ago, but got side-tracked).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what differience between ll_rw_block and readpage jiancong Linux - Software 0 06-27-2007 02:46 AM
swapping windows for linux on smartphones lanlife Linux - Laptop and Netbook 0 03-09-2007 08:42 AM
File swapping software for Linux? spikeroo Linux - Software 2 01-13-2005 09:56 PM
swapping linux hdd between pcs epoo Linux - Hardware 5 01-06-2004 09:34 PM
Swapping hardware (Compaq laptop)..how to in linux rainman4_8 Linux - Laptop and Netbook 2 12-02-2003 12:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration