[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGsJ_4yAX8QbCBe+zfNj1i8USZGLXOomB7pFzm5F_+aQ=ukyAQ@mail.gmail.com>
Date: Sat, 22 Feb 2025 21:21:00 +1300
From: Barry Song <21cnbao@...il.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Yosry Ahmed <yosry.ahmed@...ux.dev>, Minchan Kim <minchan@...nel.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
"Sridhar, Kanchana P" <kanchana.p.sridhar@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "linux-mm@...ck.org" <linux-mm@...ck.org>,
"hannes@...xchg.org" <hannes@...xchg.org>, "nphamcs@...il.com" <nphamcs@...il.com>,
"chengming.zhou@...ux.dev" <chengming.zhou@...ux.dev>,
"usamaarif642@...il.com" <usamaarif642@...il.com>, "ryan.roberts@....com" <ryan.roberts@....com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>, "davem@...emloft.net" <davem@...emloft.net>,
"clabbe@...libre.com" <clabbe@...libre.com>, "ardb@...nel.org" <ardb@...nel.org>,
"ebiggers@...gle.com" <ebiggers@...gle.com>, "surenb@...gle.com" <surenb@...gle.com>,
"Accardi, Kristen C" <kristen.c.accardi@...el.com>,
"Feghali, Wajdi K" <wajdi.k.feghali@...el.com>, "Gopal, Vinodh" <vinodh.gopal@...el.com>
Subject: Re: [PATCH v5 02/12] crypto: acomp - Define new interfaces for
compress/decompress batching.
On Sat, Feb 22, 2025 at 8:23 PM Herbert Xu <herbert@...dor.apana.org.au> wrote:
>
> On Sat, Feb 22, 2025 at 08:13:13PM +1300, Barry Song wrote:
> >
> > Somehow, I find your comment reasonable. Another point I want
> > to mention is the semantic difference. For example, in a system
> > with only one algorithm, a dst_buf overflow still means a successful
> > swap-out. However, other errors actually indicate an I/O failure.
> > In such cases, vmscan.c will log the relevant error in pageout() to
> > notify the user.
>
> I'm talking specifically about the error from the Crypto API,
> not any other error. So if you werer using some sort of an
> offload device to do the compression, that could indeed fail
> due to an IO error (perhaps the PCI bus is on fire :)
>
> But because that's reported through the Crypto API, it should
> not be treated any differently than an incompressible page,
> except for reporting purposes.
I'm referring more to the mm subsystem :-)
Let me provide a concrete example. Below is a small program that will
swap out 16MB of memory to zRAM:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#define MB (1024 * 1024)
#define SIZE (16 * MB)
int main() {
void *addr = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, MAP_ANON |
MAP_PRIVATE, -1, 0);
if (addr == MAP_FAILED) {
perror("mmap failed");
return 1;
}
for (size_t i = 0; i < SIZE / sizeof(int); i++) {
((int*)addr)[i] = rand();
}
if (madvise(addr, SIZE, MADV_PAGEOUT) != 0) {
perror("madvise failed");
return 1;
}
while (1);
return 0;
}
For errors other than dst_buf overflow, we receive:
/ # ./a.out &
/ # free
total used free shared buff/cache available
Mem: 341228 77036 251872 0 20600 264192
Swap: 2703356 0 2703356
[1]+ Done ./a.out
/ # cat /proc/vmstat | grep swp
pswpin 0
pswpout 0
...
No memory has been swapped out, the swap-out counter is zero, and
the swap file is not used at all.
If this is an incompressible page(I mean dst_buf overflow error), there is
no actual issue, and we get the following:
/ #
/ # free
total used free shared buff/cache available
Mem: 341228 92948 236248 0 20372 248280
Swap: 2703356 16384 2686972
/ # cat /proc/vmstat | grep swp
pswpin 0
pswpout 4096
...
>
> Cheers,
> --
> Email: Herbert Xu <herbert@...dor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
>
Thanks
Barry
Powered by blists - more mailing lists