Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329133
b: refs/heads/master
c: e3483a5
h: refs/heads/master
i:
  329131: 38489a2
v: v3
  • Loading branch information
Dan Magenheimer authored and Konrad Rzeszutek Wilk committed Sep 21, 2012
1 parent 6092463 commit 95e28a3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a00bb1e9fc0925c0061e9d844523a3a47a7e2f7f
refs/heads/master: e3483a5f3a8ef448c229a2aceca9b2ad6a46b8ec
2 changes: 2 additions & 0 deletions trunk/include/linux/frontswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ extern struct frontswap_ops
extern void frontswap_shrink(unsigned long);
extern unsigned long frontswap_curr_pages(void);
extern void frontswap_writethrough(bool);
#define FRONTSWAP_HAS_EXCLUSIVE_GETS
extern void frontswap_tmem_exclusive_gets(bool);

extern void __frontswap_init(unsigned type);
extern int __frontswap_store(struct page *page);
Expand Down
23 changes: 22 additions & 1 deletion trunk/mm/frontswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ EXPORT_SYMBOL(frontswap_enabled);
*/
static bool frontswap_writethrough_enabled __read_mostly;

/*
* If enabled, the underlying tmem implementation is capable of doing
* exclusive gets, so frontswap_load, on a successful tmem_get must
* mark the page as no longer in frontswap AND mark it dirty.
*/
static bool frontswap_tmem_exclusive_gets_enabled __read_mostly;

#ifdef CONFIG_DEBUG_FS
/*
* Counters available via /sys/kernel/debug/frontswap (if debugfs is
Expand Down Expand Up @@ -96,6 +103,15 @@ void frontswap_writethrough(bool enable)
}
EXPORT_SYMBOL(frontswap_writethrough);

/*
* Enable/disable frontswap exclusive gets (see above).
*/
void frontswap_tmem_exclusive_gets(bool enable)
{
frontswap_tmem_exclusive_gets_enabled = enable;
}
EXPORT_SYMBOL(frontswap_tmem_exclusive_gets);

/*
* Called when a swap device is swapon'd.
*/
Expand Down Expand Up @@ -174,8 +190,13 @@ int __frontswap_load(struct page *page)
BUG_ON(sis == NULL);
if (frontswap_test(sis, offset))
ret = frontswap_ops.load(type, offset, page);
if (ret == 0)
if (ret == 0) {
inc_frontswap_loads();
if (frontswap_tmem_exclusive_gets_enabled) {
SetPageDirty(page);
frontswap_clear(sis, offset);
}
}
return ret;
}
EXPORT_SYMBOL(__frontswap_load);
Expand Down

0 comments on commit 95e28a3

Please sign in to comment.