Received: by 10.223.176.46 with SMTP id f43csp281192wra; Tue, 23 Jan 2018 20:59:21 -0800 (PST) X-Google-Smtp-Source: AH8x227RZgebdWdoxquXi7g8/jT2l76rwLsdb+x9aAfnEXNHPSSnPICMOKLOnQTlaXY0fv3t4RhM X-Received: by 10.101.81.141 with SMTP id h13mr800620pgq.241.1516769961180; Tue, 23 Jan 2018 20:59:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516769961; cv=none; d=google.com; s=arc-20160816; b=xwf6y6lya9Gu6PCgthccxqDqVQoEkc3MX8V2DP3ldHSvqMP4658is3l5ZyAXp6Q3pm ytmIpy0rTO/KInaHn6+tkwHgKma69KjZJTGXrK6dzJP+acQ0tvW9s424bF9XsUUNqRIs nLQdOfJ6EfKCyx+XL6V1Tmesky4jIfgf+URDQf53p9k+KMAZ4vvFLgfEEsC8IxydDGik PCsV+vjkMIG5+wy1YDqodlzm1JshUoqfcgQB3r7J5odG9ZplJrbV0VpgoDQ2LbkZxwVp 8TywOF2dKqrTgHpKz7qmFiPPFjjcWERy3zYyCf64xa+4DJ3ffGtsxecfZHegk2Nz99Yr RSCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=CgZtOwK/owCZjGFwAZ9SBqfSER7CZzjpe3wZIjp92O4=; b=h2tvDyd8vKQvByeBP5ZyZ9EHAWgFywRRwGhtqrXwiglH8wDxVizfDKyTllBWWyERc6 /Y30HNQ9H8/PYjVl8hyxD2exqHyaqOyJuH7S+JpsLCMI1TBmP19yUaBTYiIX5GbRL1K1 +1L4/I3IqZrui4RhxCvvuL7yGdQMkwm7mVv7ArUQQbV9ymvKHYrShF0XOou/V6r5p+AN 6GrWWjwPZPF7mEEY1/lpmd0Wz1/GB4nJtC9rhvr7c2n3LXC1G8rZyUfct7n2u9FeEsSQ BjXfeDfJiPxeALI86xYIuqGHltOKa4Eqb8JNK/aA+8j5y5i7RuFyF/qSN3O3WyLHhFBh bEsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=gjSQjsGo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t76si15582821pgc.219.2018.01.23.20.59.07; Tue, 23 Jan 2018 20:59:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=gjSQjsGo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752833AbeAXEPR (ORCPT + 99 others); Tue, 23 Jan 2018 23:15:17 -0500 Received: from mail-sn1nam01on0126.outbound.protection.outlook.com ([104.47.32.126]:36640 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752730AbeAXEOj (ORCPT ); Tue, 23 Jan 2018 23:14:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CgZtOwK/owCZjGFwAZ9SBqfSER7CZzjpe3wZIjp92O4=; b=gjSQjsGoNU2r/ZVUMSPZi9bCwfk/8rLX2p4F5g+km6JLFrnWCAiUKE6kOlwPKuayZR3kLaOZV5veAP9K3A5mLVeWSFrgvZkBozOUmdqA6LnBPB/4Kren241BJl8h9eTRgyntBQW7oWUvh/rxPx+TMpbLB2g+/3GLQR58jujsISk= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0998.namprd21.prod.outlook.com (52.132.133.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.0; Wed, 24 Jan 2018 04:14:37 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7%2]) with mapi id 15.20.0464.000; Wed, 24 Jan 2018 04:14:37 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Martin Schwidefsky , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 028/100] s390: fix alloc_pgste check in init_new_context again Thread-Topic: [PATCH AUTOSEL for 4.14 028/100] s390: fix alloc_pgste check in init_new_context again Thread-Index: AQHTlMnY2ooNU1KOFEWrmxYG70lcVQ== Date: Wed, 24 Jan 2018 04:14:37 +0000 Message-ID: <20180124041414.32065-28-alexander.levin@microsoft.com> References: <20180124041414.32065-1-alexander.levin@microsoft.com> In-Reply-To: <20180124041414.32065-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0998;7:aHlxPu8tMgmN5uQ4cyEngMDkeBkEa4IKlBiCAbVmkwqF8VzwZxIVM16/y5LQhqIuRz+5M/elHNi/fTMj0XRUtTNynyUKNQwcJCnU1UAoTPzlTa4hyRr5vtRjmBikrbDovBVbt5azqI4XMe+0JEc8rwAAk/9viLA83ct5PxTgthffbzfJddJ25VC8XczTbKuCgZfXWhsgA5Mr9s21USUh3A/+2Kk8yDO5S2TUPkZ39fTeD2LsGJ9jOzUbdavtaZKK x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-ms-office365-filtering-correlation-id: 7f2d9dd4-2c1e-4ab4-2f4a-08d562e0fb6a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:DM5PR2101MB0998; x-ms-traffictypediagnostic: DM5PR2101MB0998: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(190383065149520)(104084551191319); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231046)(2400081)(944501161)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB0998;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0998; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39380400002)(346002)(39860400002)(396003)(376002)(199004)(189003)(14454004)(3660700001)(6346003)(10290500003)(105586002)(66066001)(6506007)(8676002)(22452003)(86612001)(54906003)(10090500001)(81166006)(81156014)(76176011)(110136005)(86362001)(68736007)(106356001)(59450400001)(8936002)(3280700002)(36756003)(25786009)(107886003)(2501003)(99286004)(2906002)(26005)(2950100002)(72206003)(102836004)(305945005)(6116002)(3846002)(5660300001)(4326008)(478600001)(316002)(53936002)(97736004)(2900100001)(5250100002)(6512007)(6436002)(6486002)(1076002)(7736002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0998;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: PW+lyNxr1BtDfBSUSlciaO59xjmNMIEM0AIGkFWvBnrhhp/VuWRG2PVOzh7vpCBeN+Jp/+b5xXU6SJQgWA7e0g== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f2d9dd4-2c1e-4ab4-2f4a-08d562e0fb6a X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:14:37.1578 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0998 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Schwidefsky [ Upstream commit 53c4ab70c11c3ba1b9e3caa8e8c17e9c16d9cbc0 ] git commit badb8bb983e9 "fix alloc_pgste check in init_new_context" fixed the problem of 'current->mm =3D=3D NULL' in init_new_context back in 2011. git commit 3eabaee998c7 "KVM: s390: allow sie enablement for multi- threaded programs" completely removed the check against alloc_pgste. git commit 23fefe119ceb "s390/kvm: avoid global config of vm.alloc_pgste=3D= 1" re-added a check against the alloc_pgste flag but without the required check for current->mm !=3D NULL. For execve() called by a kernel thread init_new_context() reads from ((struct mm_struct *) NULL)->context.alloc_pgste to decide between 2K vs 4K page tables. If the bit happens to be set for the init process it will be created with large page tables. This decision is inherited by all the children of init, this waste quite some memory. Re-add the check for 'current->mm !=3D NULL'. Fixes: 23fefe119ceb ("s390/kvm: avoid global config of vm.alloc_pgste=3D1") Signed-off-by: Martin Schwidefsky Signed-off-by: Sasha Levin --- arch/s390/include/asm/mmu_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mm= u_context.h index 43607bb12cc2..a6cc744ff5fb 100644 --- a/arch/s390/include/asm/mmu_context.h +++ b/arch/s390/include/asm/mmu_context.h @@ -28,7 +28,7 @@ static inline int init_new_context(struct task_struct *ts= k, #ifdef CONFIG_PGSTE mm->context.alloc_pgste =3D page_table_allocate_pgste || test_thread_flag(TIF_PGSTE) || - current->mm->context.alloc_pgste; + (current->mm && current->mm->context.alloc_pgste); mm->context.has_pgste =3D 0; mm->context.use_skey =3D 0; mm->context.use_cmma =3D 0; --=20 2.11.0