From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754557AbcIUFci (ORCPT ); Wed, 21 Sep 2016 01:32:38 -0400 Received: from g9t1613g.houston.hpe.com ([15.241.32.99]:37508 "EHLO g9t1613g.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbcIUFcg (ORCPT ); Wed, 21 Sep 2016 01:32:36 -0400 From: Juerg Haefliger Subject: Re: [kernel-hardening] [RFC PATCH v2 2/3] xpfo: Only put previous userspace pages into the hot cache To: Dave Hansen , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-x86_64@vger.kernel.org References: <20160902113909.32631-1-juerg.haefliger@hpe.com> <20160914071901.8127-1-juerg.haefliger@hpe.com> <20160914071901.8127-3-juerg.haefliger@hpe.com> <57D95FA3.3030103@intel.com> <7badeb6c-e343-4327-29ed-f9c9c0b6654b@hpe.com> <57D9633A.2010702@intel.com> Cc: vpk@cs.columbia.edu Message-ID: <09d3ac8c-1111-b7aa-4720-b7a7b7c7798b@hpe.com> Date: Wed, 21 Sep 2016 07:32:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <57D9633A.2010702@intel.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="c2csM3GwGuAP6k4UUq4uQ3pOeC0oH3gwe" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --c2csM3GwGuAP6k4UUq4uQ3pOeC0oH3gwe Content-Type: multipart/mixed; boundary="cp3KG1pRWNVkg2cUrE2FeqpfXPuIvKHFp"; protected-headers="v1" From: Juerg Haefliger To: Dave Hansen , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-x86_64@vger.kernel.org Cc: vpk@cs.columbia.edu Message-ID: <09d3ac8c-1111-b7aa-4720-b7a7b7c7798b@hpe.com> Subject: Re: [kernel-hardening] [RFC PATCH v2 2/3] xpfo: Only put previous userspace pages into the hot cache References: <20160902113909.32631-1-juerg.haefliger@hpe.com> <20160914071901.8127-1-juerg.haefliger@hpe.com> <20160914071901.8127-3-juerg.haefliger@hpe.com> <57D95FA3.3030103@intel.com> <7badeb6c-e343-4327-29ed-f9c9c0b6654b@hpe.com> <57D9633A.2010702@intel.com> In-Reply-To: <57D9633A.2010702@intel.com> --cp3KG1pRWNVkg2cUrE2FeqpfXPuIvKHFp Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 09/14/2016 04:48 PM, Dave Hansen wrote: >> On 09/02/2016 10:39 PM, Dave Hansen wrote: >>> On 09/02/2016 04:39 AM, Juerg Haefliger wrote: >>> Does this >>> just mean that kernel allocations usually have to pay the penalty to >>> convert a page? >> >> Only pages that are allocated for userspace (gfp & GFP_HIGHUSER =3D=3D= GFP_HIGHUSER) which were >> previously allocated for the kernel (gfp & GFP_HIGHUSER !=3D GFP_HIGHU= SER) have to pay the penalty. >> >>> So, what's the logic here? You're assuming that order-0 kernel >>> allocations are more rare than allocations for userspace? >> >> The logic is to put reclaimed kernel pages into the cold cache to >> postpone their allocation as long as possible to minimize (potential) >> TLB flushes. >=20 > OK, but if we put them in the cold area but kernel allocations pull the= m > from the hot cache, aren't we virtually guaranteeing that kernel > allocations will have to to TLB shootdown to convert a page? No. Allocations for the kernel never require a TLB shootdown. Only alloca= tions for userspace (and only if the page was previously a kernel page). > It seems like you also need to convert all kernel allocations to pull > from the cold area. Kernel allocations can continue to pull from the hot cache. Maybe introdu= ce another cache for the userspace pages? But I'm not sure what other implications this might have= =2E =2E..Juerg --cp3KG1pRWNVkg2cUrE2FeqpfXPuIvKHFp-- --c2csM3GwGuAP6k4UUq4uQ3pOeC0oH3gwe Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJX4httAAoJEHVMOpb5+LSMZ70P+wUBIgtKwmFUXkR1gRWJRVMx qaebjDcW32Edkxrg0579JSX3QHbpdQ9FU/oA/2gAGWpBi+w1WzJM/RzRHPxEG+ef e9vimmquTKzWdJSwEy1AqJSwF3QE39o0aJmsGBycvrc9mKQKb8rSSjpthSlOPCtb S8a9IRL3zghpOAeQSkKuiWYhYTHcfmYQpSBcBrzP3cCuX17LNKNHIGeRb4uFdbMA MMtSUCnXt8mkk5HgTXkAGv0UN+ox+bBIQ1hzHbdyTSahKzi6pIDlcufMaz9JSxHH CVVdll/vzPBB2hAQ7nTa+4bOULe091bHMDM4ibI9O3e70E1HIdGwjyKHZFdTMQeT Ft8GC4+LRQYphOlZi/UrhzLPaZMfew4PZAslo6EuPyixxZ+9B/hMy70O35p8y1zL 3RYb+oAPF8WGUQXQ71DHj3eOVaHxPwTxFXSF2rdRoGeicQEN1UP8J3X6ztbrUXR6 rPVoArezDHp1vaj7IzeLAK/HDUKGQvhMi4sur9AHgdu6GK0zKg59OYZEgUHcilOU TvatAm5stL1IA127BzN1LBE4TZgIx78PxIqtTHXX5SR6n0x0WstcEgXuV5gR1YF+ vxHNnBNBlLWTI5ztKRu5fD5pJRlRdqdua9WZEJVjj94vR+WgkE0tD5yMr2YPGoDZ 9F1XnrIX6PCxw9lxJ8mq =MRdI -----END PGP SIGNATURE----- --c2csM3GwGuAP6k4UUq4uQ3pOeC0oH3gwe--