Messages in this thread | ![/](/images/icornerl.gif) | | Date | Tue, 13 May 2014 11:33:23 +0100 | From | Mel Gorman <> | Subject | Re: [PATCHv2 3/4] plist: add plist_requeue |
| |
On Mon, May 12, 2014 at 12:38:19PM -0400, Dan Streetman wrote: > Add plist_requeue(), which moves the specified plist_node after > all other same-priority plist_nodes in the list. This is > essentially an optimized plist_del() followed by plist_add(). > > This is needed by swap, which (with the next patch in this set) > uses a plist of available swap devices. When a swap device > (either a swap partition or swap file) are added to the system > with swapon(), the device is added to a plist, ordered by > the swap device's priority. When swap needs to allocate a page > from one of the swap devices, it takes the page from the first swap > device on the plist, which is the highest priority swap device. > The swap device is left in the plist until all its pages are > used, and then removed from the plist when it becomes full. > > However, as described in man 2 swapon, swap must allocate pages > from swap devices with the same priority in round-robin order; > to do this, on each swap page allocation, swap uses a page from > the first swap device in the plist, and then calls plist_requeue() > to move that swap device entry to after any other same-priority > swap devices. The next swap page allocation will again use a > page from the first swap device in the plist and requeue it, > and so on, resulting in round-robin usage of equal-priority > swap devices. > > Also add plist_test_requeue() test function, for use by plist_test() > to test plist_requeue() function. > > Signed-off-by: Dan Streetman <ddstreet@ieee.org> > Cc: Steven Rostedt <rostedt@goodmis.org> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Mel Gorman <mgorman@suse.de> > Cc: Paul Gortmaker <paul.gortmaker@windriver.com> > Cc: Thomas Gleixner <tglx@linutronix.de> >
Acked-by: Mel Gorman <mgorman@suse.de>
-- Mel Gorman SUSE Labs
| ![\](/images/icornerr.gif) |