Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jun 2012 21:22:32 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Ian Lepore <freebsd@damnhippie.dyndns.org>
Cc:        Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>, freebsd-hackers@freebsd.org
Subject:   Re: wired memory - again!
Message-ID:  <20120613182232.GT2337@deviant.kiev.zoral.com.ua>
In-Reply-To: <1339593249.73426.5.camel@revolution.hippie.lan>
References:  <alpine.BSF.2.00.1206090920030.84632@wojtek.tensor.gdynia.pl> <1339259223.36051.328.camel@revolution.hippie.lan> <20120609165217.GO85127@deviant.kiev.zoral.com.ua> <alpine.BSF.2.00.1206092244550.9248@wojtek.tensor.gdynia.pl> <1339512694.36051.362.camel@revolution.hippie.lan> <20120612204508.GP2337@deviant.kiev.zoral.com.ua> <1339593249.73426.5.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help

--Yg/4YF7t1SayoUom
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jun 13, 2012 at 07:14:09AM -0600, Ian Lepore wrote:
> On Tue, 2012-06-12 at 23:45 +0300, Konstantin Belousov wrote:
> > On Tue, Jun 12, 2012 at 08:51:34AM -0600, Ian Lepore wrote:
> > > On Sat, 2012-06-09 at 22:45 +0200, Wojciech Puchar wrote:
> > > > >
> > > > > First, all memory allocated by UMA and consequently malloc(9) is
> > > > > wired. In other words, almost all memory used by kernel is accoun=
ted
> > > > > as wired.
> > > > >
> > > > yes i understand this. still i found no way how to find out what al=
located=20
> > > > that much.
> > > >=20
> > > >=20
> > > > > Second, the buffer cache wires the pages which are inserted into =
VMIO
> > > > > buffers. So your observation is basically right, cached buffers m=
eans
> > > >=20
> > > > what are exactly "VMIO" buffers. i understand that page must be wir=
ed WHEN=20
> > > > doing I/O.
> > > > But i have too much wired memory even when doing no I/O at all.
> > >=20
> > > I agree, this is The Big Question for me.  Why does the system keep
> > > wired writable mappings of the buffers in kva after the IO operations
> > > are completed? =20
> > Read about buffer cache, e.g. in the Design and Implementation of
> > the FreeBSD OS book.
> >=20
> > >=20
> > > If it did not do so, it would fix the instruction-cache-disabled bug
> > > that kills performance on VIVT cache architectures (arm and mips) and=
 it
> > > would reduce the amount of wired memory (that apparently doesn't need=
 to
> > > be wired, unless I've missed the implications of a previous reply in
> > > this thread).
> >=20
> > I have no idea what is the bug you are talking about. If my guess is
> > right, and it specifically references unability of some processors
> > to correctly handle several mappings of the same physical page into
> > different virtual addresses due to cache tagging using virtual address
> > instead of physical, then this is a hardware bug, not software.
> >=20
>=20
> This bug:
>=20
> http://lists.freebsd.org/pipermail/freebsd-arm/2012-January/003288.html
>=20
> The bug isn't the VIVT cache hardware, it's the fact that the way we
> handle the requirements of the hardware has the side effect of leaving
> the instruction cache bit disabled on executable pages because the
> kernel keeps writable mappings of the pages even after the IO is done.
Can you point me at the exact code in arm pmap ?

I remember an issue on PPC which Nathan discussed, that sounds somewhat
similar (but I still do not understand what exactly happens on ARM). On
PowerPC, icache needs to be explicitely flushed if write happen to the
executable mapping. See r233949 for current solution. There were some
followups, but I believe the core change is still valid.

>=20
> > AFAIR, at least HP PA and MIPS have different instantiation of this pro=
blem.
> > Our kernel uses multi-mapping quite often, and buffers is only one exam=
ple.
> >=20
> > Also, why do you think that the pages entered into buffers shall not be
> > wired, it is completely beyond my understanding.
>=20
> What's beyond my understanding is why a page has to remain wired after
> the IO is complete.  That question seems to me to be tangentially
> related to the above question of why the kernel needs to keep a writable
> mapping of the buffer after it's done writing into the page (either via
> DMA or via uiomove() depending on the direction of the IO).

Because the buffer is cached.

--Yg/4YF7t1SayoUom
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAk/Y2mgACgkQC3+MBN1Mb4jf5gCghvVaGykbW1nf5e1OY8ptkuUy
3aMAoIo//+r3F/M0KPwG2W2fZCErm1Pl
=gt/L
-----END PGP SIGNATURE-----

--Yg/4YF7t1SayoUom--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120613182232.GT2337>