From patchwork Thu Mar 7 07:51:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159801 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7135723jad; Wed, 6 Mar 2019 23:51:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwdQ2+pzaL3prsODYzBawBsyfWxSLBqwFkIlKFCzBvJZlVmuUn6gkyg+MUpZIYnWYq5Hz5N X-Received: by 2002:aa7:8c4d:: with SMTP id e13mr11603893pfd.53.1551945092474; Wed, 06 Mar 2019 23:51:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551945092; cv=none; d=google.com; s=arc-20160816; b=bMMDEqoZ2tUwA/kXr/sGdQEzDkuj3FKOEp09fQtIvqrxd13L5+Y2oliQ07A7rgKUAc wn2hrye4ptSqNr940J7hhetOWUj9KUDF9RSKlg23MqG62gnzNhvjbQ446zB/couU7rSW NOu/smCk/5voGulTFrl8aZ2dI6qPD1KAjA8vfN4USp3TzlzXibMb/G4fFdh2jQDoA52E /8qWswdez9F4cZxxAcnKrvcjR5Y02XM1kO0U31SS5cMYIjL4JsBKrlQe2J0jqn4YV68j 05IZt3tBhJAiLq6a5Kt9RjSwiy8TD46RJwDM63mQoPfP8pjM6IxNWNAl7kPv4qe3qqQn +J2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=doVSihVtvnS6CkNQalvfCsjdYDgV4LO3GBdowmBNjww=; b=wxiErK214w78vOA5LYNzQ9txXm5GgBt0e1TxQKeLQj/RgKb7FrRf2Ag1zXr5/nGgiy 5LurPvnJDjr4ofWEFSi4PtHv81rSp5sSQ2r6Xzqlxtfr5DRoXDVlPAwMHAU6WoWQ3aLI UN9SxjhLs+M51FlamVaBujiW6jJWX92CvJckHHLp42CAniD3IYc7KgQ8eKD6N8r1Z08u cPdNH/0r+3LfDFgYlUuPODiduqrhFb4JTL4xQ1TiMF2tMjnSwDJPMIEZnEvFKMdetPlT fS4gs8rNTu/gR4ULmAL38iTIrOcN4arB0KWSu3t3Is41pSp6F/hcU2QYGpCbVm/vk2WL p5+g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x18si3594414pll.104.2019.03.06.23.51.32; Wed, 06 Mar 2019 23:51:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726296AbfCGHva (ORCPT + 31 others); Thu, 7 Mar 2019 02:51:30 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:39801 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbfCGHva (ORCPT ); Thu, 7 Mar 2019 02:51:30 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1McYTD-1gW1pI21dd-00cwuj; Thu, 07 Mar 2019 08:51:25 +0100 From: Arnd Bergmann To: Andrew Morton Cc: linux-mm@kvack.org, Arnd Bergmann , Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , linux-kernel@vger.kernel.org Subject: [PATCH] page flags: prioritize kasan bits over last-cpuid Date: Thu, 7 Mar 2019 08:51:05 +0100 Message-Id: <20190307075124.3424302-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:veH9Knc6kktqy1oegAvldWvaMKGPY1paYlybq/Hp0sKWNk7FLma JKa79ay422Mv9MbcoOUDNPHaSLB7jZq+QX818+mOki0oF8NUOm7CgxX5lt/LtD+8jNI1ltM Ym6zcNiH3yMmouiTvVBkleWG+2W7c53iCCf4dPAJ/V9MRoJ5X4t6pW9suuKVK09LSjjPh5h +9kxEYL/z7zngiJq5sD9g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:jfZPdugRt4A=:v5VK1smrr5w6HduxLQTC1P G/vBUms3YCvASNGSAg3DimYiX8isn4Ux5x4KLOE4F4I26fbfEpJ/tsyCkrHX2EMmyTRXHm1d4 hkLZS4eJveZUwgohq3Hmn0yBYdgXCgduePN30/0oX52Hsy1vXHcUigfWo0WKk7SjH7AxpihOF DxuRw+yIdN9d6jrDUltAK3FxD1lqUMzi0XEDDos6YlrkgcT0ygp9dPUtYmzXgBidKxD5YHOVB q8xqOOD7eFodNVfl+EipnlNV9hdnwJq9BreYaMzOvmaEbyoRVNY4SiuSYERJKDfF4x1SyZ8l9 0zyhnGFzfpRnHGx+PCq/UYfnG/0UqkGn+8UEprRiWgH5p+3uIEinBovAjy0TLQQAh1FwuLBdB BgzNgpEfSifeovZyKQ4roCyHxE65V0enmy8Q0wTTfZ86yewWNMt9KfdqKgwvbnr5/071zOLGE dWpv//RPTlRTSmO3+JAzKT3y6AEn2VpQQPO7bwT6Kpycv4+9tUCDgQTiQ7h60mw/I6sKltxK3 +7t7HsOS2a9sz49XIbuCgCzzf/eIc8xH21yEl3URdr5fA6p3lYvLodu+RvallU3Iyf3Xv7iYG yEbWgmXQpYe4K6ZkPqLFg/5wf80oY8PNcdPUeyO5oguc54oidPa9isLS4dWoDJyrNKiCgBhtV o7uEBrcHSjdkffw2pJ61l4ORYpRchWLKWKviMgV/elZWTBQxhR+HHUuoeKrSDOo0xO6k8zq9Z GG43xegM+k4nvuXkDUievmvEZosehzGd1C6ofA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ARM64 randdconfig builds regularly run into a build error, especially when NUMA_BALANCING and SPARSEMEM are enabled but not SPARSEMEM_VMEMMAP: #error "KASAN: not enough bits in page flags for tag" The last-cpuid bits are already contitional on the available space, so the result of the calculation is a bit random on whether they were already left out or not. Adding the kasan tag bits before last-cpuid makes it much more likely to end up with a successful build here, and should be reliable for randconfig at least, as long as that does not randomize NR_CPUS or NODES_SHIFT but uses the defaults. Fixes: 2813b9c02962 ("kasan, mm, arm64: tag non slab memory allocated via pagealloc") Signed-off-by: Arnd Bergmann --- include/linux/page-flags-layout.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.20.0 Reviewed-by: Andrey Konovalov diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h index 1dda31825ec4..9bc0751e68b2 100644 --- a/include/linux/page-flags-layout.h +++ b/include/linux/page-flags-layout.h @@ -76,21 +76,23 @@ #define LAST_CPUPID_SHIFT 0 #endif -#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS +#ifdef CONFIG_KASAN_SW_TAGS +#define KASAN_TAG_WIDTH 8 +#else +#define KASAN_TAG_WIDTH 0 +#endif + +#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT+KASAN_TAG_WIDTH \ + <= BITS_PER_LONG - NR_PAGEFLAGS #define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT #else #define LAST_CPUPID_WIDTH 0 #endif -#ifdef CONFIG_KASAN_SW_TAGS -#define KASAN_TAG_WIDTH 8 #if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH+LAST_CPUPID_WIDTH+KASAN_TAG_WIDTH \ > BITS_PER_LONG - NR_PAGEFLAGS #error "KASAN: not enough bits in page flags for tag" #endif -#else -#define KASAN_TAG_WIDTH 0 -#endif /* * We are going to use the flags for the page to node mapping if its in