lkml.org 
[lkml]   [2015]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCHv3] frontswap: allow multiple backends
On Tue,  2 Jun 2015 18:08:46 -0400 Dan Streetman <ddstreet@ieee.org> wrote:

> Change frontswap single pointer to a singly linked list of frontswap
> implementations. Update Xen tmem implementation as register no longer
> returns anything.
>
> Frontswap only keeps track of a single implementation; any implementation
> that registers second (or later) will replace the previously registered
> implementation, and gets a pointer to the previous implementation that
> the new implementation is expected to pass all frontswap functions to
> if it can't handle the function itself. However that method doesn't
> really make much sense, as passing that work on to every implementation
> adds unnecessary work to implementations; instead, frontswap should
> simply keep a list of all registered implementations and try each
> implementation for any function. Most importantly, neither of the
> two currently existing frontswap implementations in the kernel actually
> do anything with any previous frontswap implementation that they
> replace when registering.
>
> This allows frontswap to successfully manage multiple implementations
> by keeping a list of them all.
>

offtopic trivia: this

--- a/mm/frontswap.c~frontswap-allow-multiple-backends-fix
+++ a/mm/frontswap.c
@@ -111,14 +111,11 @@ static inline void inc_frontswap_invalid
*/
void frontswap_register_ops(struct frontswap_ops *ops)
{
- DECLARE_BITMAP(a, MAX_SWAPFILES);
- DECLARE_BITMAP(b, MAX_SWAPFILES);
+ DECLARE_BITMAP(a, MAX_SWAPFILES) = { };
+ DECLARE_BITMAP(b, MAX_SWAPFILES) = { };
struct swap_info_struct *si;
unsigned int i;

- bitmap_zero(a, MAX_SWAPFILES);
- bitmap_zero(b, MAX_SWAPFILES);
-
spin_lock(&swap_lock);
plist_for_each_entry(si, &swap_active_head, list) {
if (!WARN_ON(!si->frontswap_map))
saves 64 bytes of text with my gcc.


It shouldn't be open-coded here, but a new macro in bitmap.h could be
useful, assuming it's a win for other sizes of bitmaps.


\
 
 \ /
  Last update: 2015-06-03 01:01    [W:0.042 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site