Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp587337pxx; Mon, 26 Oct 2020 16:05:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPOWK3gPERLQbRIT7FdBPf8ME86MXS/IO7FvxVr+E0Sbnp3kpZ8QI8rRwtCSK+fj3kVOxD X-Received: by 2002:a17:906:1411:: with SMTP id p17mr18705458ejc.102.1603753546402; Mon, 26 Oct 2020 16:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603753546; cv=none; d=google.com; s=arc-20160816; b=Ow35YDBZqvbdfP11KYpwzMBwtvE5maIbY9eeQqt1AgfjYySKrug/09fAbZrscOm/KR gbsT2mNDC5NdWOfJ+0u7qz6bINSHT0AIzX/yuezAyFt+r95gHFS8flFnflaU9dPRl/f/ YV5MXrTI2SbjK+r7A/GACcfxtTgiAKnUKvx2PMilrwCkcdrq98eToGhqoFGWRxRsWVLH SL4BtAIO9d5Zqph38LOfd3SAReYK6eaFQsYN6xXJw0bxfoXJgLmvtGBcCSVXRHap4a6n 6TCrhm8At/UgelIBCIHC128Q3x4+L+n5taBdgLUHUpgNO8QAejN3pk5/Wv/ZPOzCE3qc xLyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GJ201E+bFYU75VFArletrOGgCeKcbtYiE+T6CfBC6dc=; b=sjCYvUaSfnXQ9m6Wtyy7VVQbWxYWYHzd+I+UgxoKlBtp5b5Mpp2zxKRUF9e+4ppEqx 6htNVx6J9hPPT+0Rg3A12IDreYXWiJQZNUtiu3h6YvjaJuOwGf6YTePcKoMdk8PF/bvP 9g0TJDTs3xb/LJjZEVpfgEWI38nBUvz8xVq/xB4URW2Yhu1pJVSvfFc5HcDJuxnn1H16 hY8tVsahUp/fGuaPTeuECyaEvxE6GUlBpH5wr0K4CWUCJMSMXGpgfeh7LgtwZSjIsN6l VmnlWCOMzKxiR0HH6v3tc4+Oh/bVtWBOyzPLu/d4yQqJzAtLEhpD+vVNj5DKeWWsbMCS FYkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn20si10655048ejc.324.2020.10.26.16.05.21; Mon, 26 Oct 2020 16:05:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1780176AbgJZReI (ORCPT + 99 others); Mon, 26 Oct 2020 13:34:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:43870 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1780080AbgJZReH (ORCPT ); Mon, 26 Oct 2020 13:34:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A7B66ADDB; Mon, 26 Oct 2020 17:34:06 +0000 (UTC) From: Vlastimil Babka To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Alexander Potapenko , Kees Cook , Michal Hocko , David Hildenbrand , Mateusz Nosek , Vlastimil Babka Subject: [PATCH 0/3] optimize handling of memory debugging parameters Date: Mon, 26 Oct 2020 18:33:55 +0100 Message-Id: <20201026173358.14704-1-vbabka@suse.cz> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We currently have several kernel parameters that affect page allocator wrt debugging and hardening, some also with config options: init_on_alloc, init_on_free, page_poison, debug_pagealloc. These options generally have their own static keys, but sometimes a decision for e.g. clearing a page depends on multiple options, and the handling is not as efficient as it could be. This series addresses that by centralizing the decisions into a new init_mem_debugging() function that enables individual static keys, and most paths now rely on a single static key check. Subtle dependency on the order of parameters is also eliminated (Patch 1). The result is more efficient and hopefully also more readable code. Vlastimil Babka (3): mm, page_alloc: do not rely on the order of page_poison and init_on_alloc/free parameters mm, page_poison: use static key more efficiently mm, page_alloc: reduce static keys in prep_new_page() drivers/virtio/virtio_balloon.c | 2 +- include/linux/mm.h | 36 ++++----- init/main.c | 2 +- mm/page_alloc.c | 126 ++++++++++++++++++-------------- mm/page_poison.c | 40 ++-------- 5 files changed, 97 insertions(+), 109 deletions(-) -- 2.29.0