RE: Re: [External] RE(2): FW: [LSF/MM/BPF TOPIC] SMDK inspired MM changes for CXL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>On Tue, Apr 04, 2023 at 11:59:22AM -0700, Viacheslav A.Dubeyko wrote:
>> 
>> 
>> > On Apr 1, 2023, at 3:51 AM, Gregory Price <gregory.price@xxxxxxxxxxxx> wrote:
>> > 
>> > On Tue, Apr 04, 2023 at 05:58:05PM +0000, Adam Manzanares wrote:
>> >> On Tue, Apr 04, 2023 at 11:31:08AM +0300, Mike Rapoport wrote:
>> >>> 
>> >>> The point of zswap IIUC is to have small and fast swap device and
>> >>> compression is required to better utilize DRAM capacity at expense of CPU
>> >>> time.
>> >>> 
>> >>> Presuming CXL memory will have larger capacity than DRAM, why not skip the
>> >>> compression and use CXL as a swap device directly?
>> >> 
>> >> I like to shy away from saying CXL memory should be used for swap. I see a 
>> >> swap device as storing pages in a manner that is no longer directly addressable
>> >> by the cpu. 
>> >> 
>> >> Migrating pages to a CXL device is a reasonable approach and I believe we
>> >> have the ability to do this in the page reclaim code. 
>> >> 
>> > 
>> > The argument is "why do you need swap if memory itself is elastic", and
>> > I think there are open questions about how performant using large
>> > amounts of high-latency memory is.
>> > 
>> > Think 1us-1.5us+ cross-rack attached memory.
>> > 
>> > Does it make sense to use that as CPU-addressible and migrate it on
>> > first use?  Isn't that just swap with more steps?  What happens if we
>> > just use it as swap, is the performance all that different?
>> > 
>> > I think there's a reasonable argument for exploring the idea at the
>> > higher ends of the latency spectrum.  And the simplicity of using an
>> > existing system (swap) to implement a form of proto-tiering is rather
>> > attractive in my opinion.
>> > 
>> 
>> I think the problem with swap that we need to take into account the additional
>> latency of swap-in/swap-out logic. I assume that this logic is expensive enough.
>> And if we considering the huge graph, for example, I am afraid the swap-in/swap-out
>> logic could be expensive. So, the question here is about use-case. Which use-case could
>> have benefits to employ the swap as a big space of high-latency memory? I see your point
>> that such swap could be faster than persistent storage. But which use-case can be happy
>> user of this space of high-latency memory?
>> 
>> Thanks,
>> Slava.
>> 
>
>Just spitballing here - to me this problem is two fold:
>
>I think the tiering use case and the swap use case are exactly the same.
>If tiering is sufficiently valuable, there exists a spectrum of compute
>density (cpu:dram:cxl:far-cxl) where simply using far-cxl as fast-swap
>becomes easier and less expensive than a complex tiering system.
>
>So rather than a single use-case question, it reads like a tiering
>question to me:
>
>1) Where on the 1us-20us (far cxl : nvme) spectrum does it make sense to
>   switch from a swap mechanism to simply byte-addressable memory?
>   There's a point, somewhere, where promote on first access (effectively
>   swap) is the same performance as active tiering (for a given workload).
>
>   If that point is under 2us, there's a good chance that a high-latency
>   CXL swap-system would be a major win for any workload on any cloud-based
>   system.  It's simple, clean, and reclaim doesn't have to worry about the
>   complexities of hotpluggable memory zones.
>
>
>Beyond that, to your point, what use-case is happy with this class of
>memory, and in what form?
>
>2) This is likely obscurred by the fact that many large-memory
>   applications avoid swap like the plague by sharding data and creating
>   clusters. So it's hard to answer this until it's tested, and you
>   can't test it unless you make it... woo!
>
>   Bit of a chicken/egg in here.  I don't know that anyone can say
>   definitively what workload can make use of it, but that doesn't mean
>   there isn't one.  So in the spectrum of risk/reward, at least
>   enabling some simple mechanism for the sake of exploration feels
>   exciting to say the least.
>
>
>More generally, I think a cxl-swap (cswap? ;V) would be useful exactly to
>help identify when watch-and-wait tiering becomes more performant than
>promote-on-first-use.  If you can't beat a simple fast-swap, why bother?
>
>Again, I think this is narrowly applicable to high-latency CXL. My gut
>tells me that anything under 1us is better used in a byte-addressable
>manner, but once you start hitting 1us "It makes me go hmmm..."
>
>I concede this is largely conjecture until someone tests it out, but
>certainly a fun thing to discess.

In fact, we enabled CXL swap, OS-level swap interface for CXL DRAM[1].
It was not LSF/MM proposal of this year, though.
Likewise zswap, CXL swap implements frontswap[2], but it does not perform compression using CPU cycle. 
The first motivation was to enhance TMO solution[3].
TMO uses both zswap and disk swap, and we intended to replace zswap part as CXL swap to seamlessly adopt CXL DRAM in the solution.

We agree that the primary usecase of CXL DRAM is byte-addressable memory. 
So, memory expansion with CXL DRAM will significantly resolve memory pressure of a system,
thus memory allocation would fail less and swapper would be less triggered by PFRA.

However,we think the Linux swap mechanism would be keep used for a different purpose. 
Due to CXL topology expansion and more SW overheads along with the topology, we guess the end-user latency to CXL DRAM would be increased. 
Along with the purpose of frontswap, we think CXL swap interface would fit between hypervisor and baremetal OS with more capacity sensitive and less user-interactive workload.

Let us share some performance numbers regarding CXL swap on a CXL capable testbed.
1. Latency evalution of swap in/out logic - swap-in/swap-out was 0.56us/1.07us, respectively.
2. CPU utilization - CXL swap on CXL DRAM saves x14.94 cpu utilization compared to zswap because of no (de)compression. zswap occupies aroud 70~80% cpu cycle on (de)compression logic.
3. QoS - The latency of zswap put/get was fluctuated around 1.3~14us, while that of CXL swap out/get was evenly around 0.49~0.94us. 

[1] https://github.com/OpenMPDK/SMDK/wiki/2.-SMDK-Architecture#swap
[2] https://www.kernel.org/doc/html/v5.0/vm/frontswap.html
[3] https://arxiv.org/abs/2206.02878

>~Gregory




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux