| From: Christoph Hellwig <hch@lst.de> |
| Subject: frontswap: remove frontswap_writethrough |
| |
| frontswap_writethrough is never called, so remove it. |
| |
| Link: https://lkml.kernel.org/r/20211224062246.1258487-3-hch@lst.de |
| Signed-off-by: Christoph Hellwig <hch@lst.de> |
| Reviewed-by: Juergen Gross <jgross@suse.com> |
| Cc: Dan Streetman <ddstreet@ieee.org> |
| Cc: Geert Uytterhoeven <geert@linux-m68k.org> |
| Cc: Hugh Dickins <hughd@google.com> |
| Cc: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com> |
| Cc: Matthew Wilcox (Oracle) <willy@infradead.org> |
| Cc: Seth Jennings <sjenning@redhat.com> |
| Cc: Vitaly Wool <vitaly.wool@konsulko.com> |
| Signed-off-by: Andrew Morton <akpm@linux-foundation.org> |
| --- |
| |
| Documentation/vm/frontswap.rst | 6 ------ |
| include/linux/frontswap.h | 1 - |
| mm/frontswap.c | 23 +---------------------- |
| 3 files changed, 1 insertion(+), 29 deletions(-) |
| |
| --- a/Documentation/vm/frontswap.rst~frontswap-remove-frontswap_writethrough |
| +++ a/Documentation/vm/frontswap.rst |
| @@ -39,12 +39,6 @@ a disk write and, if the data is later r |
| If a store returns failure, transcendent memory has rejected the data, and the |
| page can be written to swap as usual. |
| |
| -If a backend chooses, frontswap can be configured as a "writethrough |
| -cache" by calling frontswap_writethrough(). In this mode, the reduction |
| -in swap device writes is lost (and also a non-trivial performance advantage) |
| -in order to allow the backend to arbitrarily "reclaim" space used to |
| -store frontswap pages to more completely manage its memory usage. |
| - |
| Note that if a page is stored and the page already exists in transcendent memory |
| (a "duplicate" store), either the store succeeds and the data is overwritten, |
| or the store fails AND the page is invalidated. This ensures stale data may |
| --- a/include/linux/frontswap.h~frontswap-remove-frontswap_writethrough |
| +++ a/include/linux/frontswap.h |
| @@ -26,7 +26,6 @@ struct frontswap_ops { |
| extern void frontswap_register_ops(struct frontswap_ops *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); |
| |
| --- a/mm/frontswap.c~frontswap-remove-frontswap_writethrough |
| +++ a/mm/frontswap.c |
| @@ -33,16 +33,6 @@ static struct frontswap_ops *frontswap_o |
| for ((ops) = frontswap_ops; (ops); (ops) = (ops)->next) |
| |
| /* |
| - * If enabled, frontswap_store will return failure even on success. As |
| - * a result, the swap subsystem will always write the page to swap, in |
| - * effect converting frontswap into a writethrough cache. In this mode, |
| - * there is no direct reduction in swap writes, but a frontswap backend |
| - * can unilaterally "reclaim" any pages in use with no data loss, thus |
| - * providing increases control over maximum memory usage due to frontswap. |
| - */ |
| -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. |
| @@ -171,15 +161,6 @@ void frontswap_register_ops(struct front |
| EXPORT_SYMBOL(frontswap_register_ops); |
| |
| /* |
| - * Enable/disable frontswap writethrough (see above). |
| - */ |
| -void frontswap_writethrough(bool enable) |
| -{ |
| - frontswap_writethrough_enabled = enable; |
| -} |
| -EXPORT_SYMBOL(frontswap_writethrough); |
| - |
| -/* |
| * Enable/disable frontswap exclusive gets (see above). |
| */ |
| void frontswap_tmem_exclusive_gets(bool enable) |
| @@ -283,9 +264,7 @@ int __frontswap_store(struct page *page) |
| } else { |
| inc_frontswap_failed_stores(); |
| } |
| - if (frontswap_writethrough_enabled) |
| - /* report failure so swap also writes to swap device */ |
| - ret = -1; |
| + |
| return ret; |
| } |
| EXPORT_SYMBOL(__frontswap_store); |
| _ |