All of lore.kernel.org
 help / color / mirror / Atom feed
* mm/zswap: change to writethrough
@ 2013-11-11 19:12 ` Dan Streetman
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Streetman @ 2013-11-11 19:12 UTC (permalink / raw)
  To: sjennings
  Cc: linux-mm, linux-kernel, minchan, bob.liu, weijie.yang, k.kozlowski

Seth, have you (or anyone else) considered making zswap a writethrough
cache instead of writeback?  I think that it would significantly help
the case where zswap fills up and starts writing back its oldest pages
to disc - all the decompression work would be avoided since zswap
could just evict old pages and forget about them, and it seems likely
that when zswap is full that's probably the worst time to add extra
work/delay, while adding extra disc IO (presumably using dma) before
zswap is full doesn't seem to me like it would have much impact,
except in the case where zswap isn't full but there is so little free
memory that new allocs are waiting on swap-out.

Besides the additional disc IO that obviously comes with making zswap
writethrough (additional only before zswap fills up), are there any
other disadvantages?  Is it a common situation for there to be no
memory left and get_free_page actively waiting on swap-out, but before
zswap fills up?

Making it writethrough also could open up other possible improvements,
like making the compression and storage of new swap-out pages async,
so the compression doesn't delay the write out to disc.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* mm/zswap: change to writethrough
@ 2013-11-11 19:12 ` Dan Streetman
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Streetman @ 2013-11-11 19:12 UTC (permalink / raw)
  To: sjennings
  Cc: linux-mm, linux-kernel, minchan, bob.liu, weijie.yang, k.kozlowski

Seth, have you (or anyone else) considered making zswap a writethrough
cache instead of writeback?  I think that it would significantly help
the case where zswap fills up and starts writing back its oldest pages
to disc - all the decompression work would be avoided since zswap
could just evict old pages and forget about them, and it seems likely
that when zswap is full that's probably the worst time to add extra
work/delay, while adding extra disc IO (presumably using dma) before
zswap is full doesn't seem to me like it would have much impact,
except in the case where zswap isn't full but there is so little free
memory that new allocs are waiting on swap-out.

Besides the additional disc IO that obviously comes with making zswap
writethrough (additional only before zswap fills up), are there any
other disadvantages?  Is it a common situation for there to be no
memory left and get_free_page actively waiting on swap-out, but before
zswap fills up?

Making it writethrough also could open up other possible improvements,
like making the compression and storage of new swap-out pages async,
so the compression doesn't delay the write out to disc.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mm/zswap: change to writethrough
  2013-11-11 19:12 ` Dan Streetman
@ 2013-11-12  9:11   ` Bob Liu
  -1 siblings, 0 replies; 8+ messages in thread
From: Bob Liu @ 2013-11-12  9:11 UTC (permalink / raw)
  To: Dan Streetman
  Cc: sjennings, linux-mm, linux-kernel, minchan, weijie.yang,
	k.kozlowski, konrad.wilk


On 11/12/2013 03:12 AM, Dan Streetman wrote:
> Seth, have you (or anyone else) considered making zswap a writethrough
> cache instead of writeback?  I think that it would significantly help
> the case where zswap fills up and starts writing back its oldest pages
> to disc - all the decompression work would be avoided since zswap
> could just evict old pages and forget about them, and it seems likely
> that when zswap is full that's probably the worst time to add extra
> work/delay, while adding extra disc IO (presumably using dma) before
> zswap is full doesn't seem to me like it would have much impact,
> except in the case where zswap isn't full but there is so little free
> memory that new allocs are waiting on swap-out.
> 
> Besides the additional disc IO that obviously comes with making zswap
> writethrough (additional only before zswap fills up), are there any
> other disadvantages?  Is it a common situation for there to be no
> memory left and get_free_page actively waiting on swap-out, but before
> zswap fills up?
> 
> Making it writethrough also could open up other possible improvements,
> like making the compression and storage of new swap-out pages async,
> so the compression doesn't delay the write out to disc.
> 

I like this idea and those benefits, the only question I'm not sure is
would it be too complicate to implement this feature? It sounds like we
need to reimplement something like swapcache to handle zswap write through.

-- 
Regards,
-Bob

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mm/zswap: change to writethrough
@ 2013-11-12  9:11   ` Bob Liu
  0 siblings, 0 replies; 8+ messages in thread
From: Bob Liu @ 2013-11-12  9:11 UTC (permalink / raw)
  To: Dan Streetman
  Cc: sjennings, linux-mm, linux-kernel, minchan, weijie.yang,
	k.kozlowski, konrad.wilk


On 11/12/2013 03:12 AM, Dan Streetman wrote:
> Seth, have you (or anyone else) considered making zswap a writethrough
> cache instead of writeback?  I think that it would significantly help
> the case where zswap fills up and starts writing back its oldest pages
> to disc - all the decompression work would be avoided since zswap
> could just evict old pages and forget about them, and it seems likely
> that when zswap is full that's probably the worst time to add extra
> work/delay, while adding extra disc IO (presumably using dma) before
> zswap is full doesn't seem to me like it would have much impact,
> except in the case where zswap isn't full but there is so little free
> memory that new allocs are waiting on swap-out.
> 
> Besides the additional disc IO that obviously comes with making zswap
> writethrough (additional only before zswap fills up), are there any
> other disadvantages?  Is it a common situation for there to be no
> memory left and get_free_page actively waiting on swap-out, but before
> zswap fills up?
> 
> Making it writethrough also could open up other possible improvements,
> like making the compression and storage of new swap-out pages async,
> so the compression doesn't delay the write out to disc.
> 

I like this idea and those benefits, the only question I'm not sure is
would it be too complicate to implement this feature? It sounds like we
need to reimplement something like swapcache to handle zswap write through.

-- 
Regards,
-Bob

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mm/zswap: change to writethrough
  2013-11-12  9:11   ` Bob Liu
@ 2013-11-12 14:24     ` Dan Streetman
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Streetman @ 2013-11-12 14:24 UTC (permalink / raw)
  To: Bob Liu
  Cc: sjennings, linux-mm, linux-kernel, minchan, weijie.yang,
	k.kozlowski, konrad.wilk

On Tue, Nov 12, 2013 at 4:11 AM, Bob Liu <bob.liu@oracle.com> wrote:
>
> On 11/12/2013 03:12 AM, Dan Streetman wrote:
>> Seth, have you (or anyone else) considered making zswap a writethrough
>> cache instead of writeback?  I think that it would significantly help
>> the case where zswap fills up and starts writing back its oldest pages
>> to disc - all the decompression work would be avoided since zswap
>> could just evict old pages and forget about them, and it seems likely
>> that when zswap is full that's probably the worst time to add extra
>> work/delay, while adding extra disc IO (presumably using dma) before
>> zswap is full doesn't seem to me like it would have much impact,
>> except in the case where zswap isn't full but there is so little free
>> memory that new allocs are waiting on swap-out.
>>
>> Besides the additional disc IO that obviously comes with making zswap
>> writethrough (additional only before zswap fills up), are there any
>> other disadvantages?  Is it a common situation for there to be no
>> memory left and get_free_page actively waiting on swap-out, but before
>> zswap fills up?
>>
>> Making it writethrough also could open up other possible improvements,
>> like making the compression and storage of new swap-out pages async,
>> so the compression doesn't delay the write out to disc.
>>
>
> I like this idea and those benefits, the only question I'm not sure is
> would it be too complicate to implement this feature? It sounds like we
> need to reimplement something like swapcache to handle zswap write through.

Simply converting to writethrough should be as easy as returning
non-zero from zswap_frontswap_store(), although
zswap_writeback_entry() also needs simplification to skip the
writeback.  I think it shouldn't be difficult; I'll start working on a
first pass of a patch.

Thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mm/zswap: change to writethrough
@ 2013-11-12 14:24     ` Dan Streetman
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Streetman @ 2013-11-12 14:24 UTC (permalink / raw)
  To: Bob Liu
  Cc: sjennings, linux-mm, linux-kernel, minchan, weijie.yang,
	k.kozlowski, konrad.wilk

On Tue, Nov 12, 2013 at 4:11 AM, Bob Liu <bob.liu@oracle.com> wrote:
>
> On 11/12/2013 03:12 AM, Dan Streetman wrote:
>> Seth, have you (or anyone else) considered making zswap a writethrough
>> cache instead of writeback?  I think that it would significantly help
>> the case where zswap fills up and starts writing back its oldest pages
>> to disc - all the decompression work would be avoided since zswap
>> could just evict old pages and forget about them, and it seems likely
>> that when zswap is full that's probably the worst time to add extra
>> work/delay, while adding extra disc IO (presumably using dma) before
>> zswap is full doesn't seem to me like it would have much impact,
>> except in the case where zswap isn't full but there is so little free
>> memory that new allocs are waiting on swap-out.
>>
>> Besides the additional disc IO that obviously comes with making zswap
>> writethrough (additional only before zswap fills up), are there any
>> other disadvantages?  Is it a common situation for there to be no
>> memory left and get_free_page actively waiting on swap-out, but before
>> zswap fills up?
>>
>> Making it writethrough also could open up other possible improvements,
>> like making the compression and storage of new swap-out pages async,
>> so the compression doesn't delay the write out to disc.
>>
>
> I like this idea and those benefits, the only question I'm not sure is
> would it be too complicate to implement this feature? It sounds like we
> need to reimplement something like swapcache to handle zswap write through.

Simply converting to writethrough should be as easy as returning
non-zero from zswap_frontswap_store(), although
zswap_writeback_entry() also needs simplification to skip the
writeback.  I think it shouldn't be difficult; I'll start working on a
first pass of a patch.

Thanks!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mm/zswap: change to writethrough
  2013-11-11 19:12 ` Dan Streetman
@ 2013-11-13 15:40   ` Seth Jennings
  -1 siblings, 0 replies; 8+ messages in thread
From: Seth Jennings @ 2013-11-13 15:40 UTC (permalink / raw)
  To: Dan Streetman
  Cc: linux-mm, linux-kernel, minchan, bob.liu, weijie.yang, k.kozlowski

On Mon, Nov 11, 2013 at 02:12:12PM -0500, Dan Streetman wrote:
> Seth, have you (or anyone else) considered making zswap a writethrough
> cache instead of writeback?  I think that it would significantly help
> the case where zswap fills up and starts writing back its oldest pages
> to disc - all the decompression work would be avoided since zswap
> could just evict old pages and forget about them, and it seems likely
> that when zswap is full that's probably the worst time to add extra
> work/delay, while adding extra disc IO (presumably using dma) before
> zswap is full doesn't seem to me like it would have much impact,
> except in the case where zswap isn't full but there is so little free
> memory that new allocs are waiting on swap-out.

There are two main benefits to zswap:
1) avoid write to swap space while the compressed pool is not full and
2) reduce application delay on anonymous page faults

Doing a writethough approach eliminates benefit 1 as there would
be just as much swap out activity with or without zswap.  However, you
still retain benefit 2.

The reclaim from zswap also becomes much simplier if the the compressed
page can be treated as clean.  It doesn't need to be written back and
can just be freed and the bit in the frontswap_map unset.

I'm not opposed to this.  The obstacle of writeback has influenced the
design a lot more than I would have liked.  You do lose the benefit of
decreased swap out traffic, but the real performance killer, application
latency on an anonymous page fault, is still greatly improved.

Seth

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: mm/zswap: change to writethrough
@ 2013-11-13 15:40   ` Seth Jennings
  0 siblings, 0 replies; 8+ messages in thread
From: Seth Jennings @ 2013-11-13 15:40 UTC (permalink / raw)
  To: Dan Streetman
  Cc: linux-mm, linux-kernel, minchan, bob.liu, weijie.yang, k.kozlowski

On Mon, Nov 11, 2013 at 02:12:12PM -0500, Dan Streetman wrote:
> Seth, have you (or anyone else) considered making zswap a writethrough
> cache instead of writeback?  I think that it would significantly help
> the case where zswap fills up and starts writing back its oldest pages
> to disc - all the decompression work would be avoided since zswap
> could just evict old pages and forget about them, and it seems likely
> that when zswap is full that's probably the worst time to add extra
> work/delay, while adding extra disc IO (presumably using dma) before
> zswap is full doesn't seem to me like it would have much impact,
> except in the case where zswap isn't full but there is so little free
> memory that new allocs are waiting on swap-out.

There are two main benefits to zswap:
1) avoid write to swap space while the compressed pool is not full and
2) reduce application delay on anonymous page faults

Doing a writethough approach eliminates benefit 1 as there would
be just as much swap out activity with or without zswap.  However, you
still retain benefit 2.

The reclaim from zswap also becomes much simplier if the the compressed
page can be treated as clean.  It doesn't need to be written back and
can just be freed and the bit in the frontswap_map unset.

I'm not opposed to this.  The obstacle of writeback has influenced the
design a lot more than I would have liked.  You do lose the benefit of
decreased swap out traffic, but the real performance killer, application
latency on an anonymous page fault, is still greatly improved.

Seth

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-11-13 15:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-11 19:12 mm/zswap: change to writethrough Dan Streetman
2013-11-11 19:12 ` Dan Streetman
2013-11-12  9:11 ` Bob Liu
2013-11-12  9:11   ` Bob Liu
2013-11-12 14:24   ` Dan Streetman
2013-11-12 14:24     ` Dan Streetman
2013-11-13 15:40 ` Seth Jennings
2013-11-13 15:40   ` Seth Jennings

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.