Re: Is there any error checking on swap?

From: John-Mark Gurney <jmg_at_funkthat.com>
Date: Sun, 12 Jul 2020 18:09:41 -0700
Xin Li wrote this message on Sun, Jul 12, 2020 at 15:06 -0700:
> 
> 
> On 7/12/20 12:29 AM, John-Mark Gurney wrote:
> > bob prohaska wrote this message on Sat, Jul 11, 2020 at 20:33 -0700:
> >> Is there any error checking on swap traffic, along the lines of
> >> a checksum or parity test? 
> >>
> >> Just curious what happens if a page written out is corrupted  when
> >> it comes back.
> > 
> > Looks like it doesn't:
> > https://svnweb.freebsd.org/base/head/sys/vm/swap_pager.c?annotate=361965#l1389
> 
> Technically one can enable checks with e.g. geli(8), but note that the
> geli(8) provider will not "prime" the HMAC data so attaching the device
> will immediately spam the system log with some authentication errors due
> to GEOM tasting (because the kernel would try to read locations that
> potentially contain metadata for other GEOM providers).

Yeah, and enabling auth w/ geli(8) is problematic, as it creates a
disconnect between layers, as it expands 4096 byte writes to 9 512
byte sector writes, if you're using a 4k drive (which is pretty much
the only thing sold these days), the performance is likely to be
pretty terrible...

see:
https://svnweb.freebsd.org/base/head/sys/geom/eli/g_eli_integrity.c?annotate=361481#l56

So, it'd be doable, but less than ideal...

> For the case of swap, since the write is always page sized, it's
> probably optimal to implement something in the swap layer itself and
> store the expected checksums in memory.

+1

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."

Received on Sun Jul 12 2020 - 23:09:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:24 UTC