Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2008 16:18:57 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Skip Ford <skip@menantico.com>
Cc:        Dag-Erling =?koi8-r?B?U23DuHJncmF2?= <des@des.no>, freebsd-current@FreeBSD.org, Robert Watson <rwatson@FreeBSD.org>, Jason Evans <jasone@FreeBSD.org>, Poul-Henning Kamp <phk@FreeBSD.org>
Subject:   Re: sbrk(2) broken
Message-ID:  <20080104141857.GC57756@deviant.kiev.zoral.com.ua>
In-Reply-To: <20080104141133.GB788@menantico.com>
References:  <477C82F0.5060809@freebsd.org> <863ateemw2.fsf@ds4.des.no> <20080104002002.L30578@fledge.watson.org> <86wsqqaqbe.fsf@ds4.des.no> <20080104110511.S77222@fledge.watson.org> <20080104135438.GA788@menantico.com> <20080104135912.GB57756@deviant.kiev.zoral.com.ua> <20080104141133.GB788@menantico.com>

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

--h8+hH1OQkST14sOt
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jan 04, 2008 at 09:11:33AM -0500, Skip Ford wrote:
> Kostik Belousov wrote:
> > On Fri, Jan 04, 2008 at 08:54:38AM -0500, Skip Ford wrote:
> > > Robert Watson wrote:
> > > > On Fri, 4 Jan 2008, Dag-Erling Sm=F8rgrav wrote:
> > > > >Robert Watson <rwatson@FreeBSD.org> writes:
> > > > >>The right answer is presumably to introduce a new LIMIT_SWAP, whi=
ch
> > > > >>limits the allocation of anonymous memory by processes, and size =
it to
> > > > >>something like 90% of swap space by default.
> > > > >
> > > > >Not a good solution on its own.  You need a per-process limit as w=
ell,=20
> > > > >otherwise a malloc() bomb will still cause other processes to fail=
=20
> > > > >randomly.
> > > >=20
> > > > That was what I had in mind, the above should read RLIMIT_SWAP.
> > >=20
> > > Are you referring to the implementation of RLIMIT_SWAP in the
> > > overcommit-disable patch at:
> > >=20
> > > http://people.freebsd.org/~kib/overcommit/index.html
> > >=20
> > > ...or some other as yet unwritten implementation?  That patch doesn't
> > > currently do 90% of swap but easily can.  That's been available for a=
lmost 3
> > > years now.  I tested it at one point but not lately and it never went=
 into
> > > production.  Do you, and others, have a problem with that implementat=
ion?
> > Oh, I thought that I was the sole user of the patch. What problems did =
you
> > encountered while testing it ?
>=20
> Nope, there are two of us. :-)
>=20
> I don't remember encountering problems.  I never put it into production
> because maintaining it in a local branch was beyond my ability.  I just d=
idn't
> know enough to know what it did and didn't do, or how it would have to be
> modified to work with future changes.  I just didn't understand it enough
> to go with it and maintain it.
>=20
> > What you mean by "do 90% of swap" ?
>=20
> I was referring only to what Robert said above, that he thinks RLIMIT_SWAP
> should limit anon memory size to ~90% of swap by default.  Your patch,
> last I looked, limits it to 100% of swap by design but could be easily
> changed I think.

Ok. The patch really imposes two kind of limits:
- the total amount of anon memory that could be allocated in the whole
  system (this is what I called "disabling overcommit")
- per-user RLIMIT_SWAP limit, that account the allocation by the uid. This
  has some obvious problems with setuid(2) syscall. AFAIR, I ended up
  not moving the accounted numbers to the new uid.

Both limits can be turned on/off independently.

May be, time to revive it.

--h8+hH1OQkST14sOt
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFHfkBRC3+MBN1Mb4gRAuIKAKCqu7wKHFsS4zsrOKezEd6DeYQ0mgCfRwAV
UjCx3JJfxU6zL01EJ5Iq4/s=
=tHbx
-----END PGP SIGNATURE-----

--h8+hH1OQkST14sOt--



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