Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760098AbXJLKui (ORCPT ); Fri, 12 Oct 2007 06:50:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755549AbXJLKua (ORCPT ); Fri, 12 Oct 2007 06:50:30 -0400 Received: from viefep18-int.chello.at ([213.46.255.22]:12830 "EHLO viefep34-int.chello.at" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754671AbXJLKu3 (ORCPT ); Fri, 12 Oct 2007 06:50:29 -0400 Subject: Re: [PATCH] mm: avoid dirtying shared mappings on mlock From: Peter Zijlstra To: Nick Piggin Cc: Suleiman Souhlal , Andrew Morton , linux-kernel@vger.kernel.org, Suleiman Souhlal , linux-mm , hugh In-Reply-To: <200710120414.11026.nickpiggin@yahoo.com.au> References: <11854939641916-git-send-email-ssouhlal@FreeBSD.org> <200710120257.05960.nickpiggin@yahoo.com.au> <1192185439.27435.19.camel@twins> <200710120414.11026.nickpiggin@yahoo.com.au> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-8dNDXh0wA7zdk8Oik2ev" Date: Fri, 12 Oct 2007 12:50:22 +0200 Message-Id: <1192186222.27435.22.camel@twins> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2454 Lines: 67 --=-8dNDXh0wA7zdk8Oik2ev Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2007-10-12 at 04:14 +1000, Nick Piggin wrote: > On Friday 12 October 2007 20:37, Peter Zijlstra wrote: > > On Fri, 2007-10-12 at 02:57 +1000, Nick Piggin wrote: > > > On Friday 12 October 2007 19:03, Peter Zijlstra wrote: > > > > Subject: mm: avoid dirtying shared mappings on mlock > > > > > > > > Suleiman noticed that shared mappings get dirtied when mlocked. > > > > Avoid this by teaching make_pages_present about this case. > > > > > > > > Signed-off-by: Peter Zijlstra > > > > Acked-by: Suleiman Souhlal > > > > > > Umm, I don't see the other piece of this thread, so I don't > > > know what the actual problem was. > > > > > > But I would really rather not do this. If you do this, then you > > > now can get random SIGBUSes when you write into the memory if it > > > can't allocate blocks or ... (some other filesystem specific > > > condition). > > > > I'm not getting this, make_pages_present() only has to ensure all the > > pages are read from disk and in memory. How is this different from a > > read-scan? >=20 > I guess because we've mlocked a region that has PROT_WRITE access... > but actually, I suppose mlock doesn't technically require that we > can write to the memory, only that the page isn't swapped out. >=20 > Still, it is nice to be able to have a reasonable guarantee of > writability. >=20 >=20 > > The pages will still be read-only due to dirty tracking, so the first > > write will still do page_mkwrite(). >=20 > Which can SIGBUS, no? Sure, but that is no different than any other mmap'ed write. I'm not seeing how an mlocked region is special here. I agree it would be nice if mmap'ed writes would have better error reporting than SIGBUS, but such is life. --=-8dNDXh0wA7zdk8Oik2ev Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBHD1FuXA2jU0ANEf4RApuYAJ0U8uIBktwwwXZZbMeBHLJcvUDjfwCfdFZb NUnS2XJhJU69R0nFc12+Jls= =fg02 -----END PGP SIGNATURE----- --=-8dNDXh0wA7zdk8Oik2ev-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/