From patchwork Tue Mar 28 09:58:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 13190786 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C698C76195 for ; Tue, 28 Mar 2023 09:58:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21DCE6B0072; Tue, 28 Mar 2023 05:58:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CD286B0074; Tue, 28 Mar 2023 05:58:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BD196B0075; Tue, 28 Mar 2023 05:58:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F3AB76B0072 for ; Tue, 28 Mar 2023 05:58:31 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B78CA1A0189 for ; Tue, 28 Mar 2023 09:58:31 +0000 (UTC) X-FDA: 80617857222.19.F565C07 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by imf12.hostedemail.com (Postfix) with ESMTP id 6F94F4001E for ; Tue, 28 Mar 2023 09:58:29 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=H20nkFH8; spf=pass (imf12.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679997510; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=6MISSvCouqA9cx2hoXCbIEOFQ/tw2bO4d83GG2zGgvE=; b=ObmIkaQIklHwi1ynv7Lpg4/g1O41vnl4P0Di7J1xE2sQJqICnT+CtbnVzUwEmvB+Sreb7v kiYVeIxRFy/9/Qccdf9MuKljsT4+UMuwIVcbLpLmYf4R0JhRdxH0A7qri58lFByBxVOzGr 6BwsT0xzo6/w8t4DSSDz46tuMb1hEgc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=H20nkFH8; spf=pass (imf12.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679997510; a=rsa-sha256; cv=none; b=H2+Mx3j3GPWBOcUdwswfDRm+UH4YT69Ro6AQb6DuwMgVhKeinHBOO+iMeje77R6UA1tI34 PVSzLcbLWBtPCI+B5LI22g7OPmBhsepcg4Iit6w1NJR5dg6RnX8eq/tbIBsoIcdhUWAHlo Oc1hvmRKYprdfZhDvh6C7yK5dnXTln0= Received: by mail-pg1-f170.google.com with SMTP id y35so6850118pgl.4 for ; Tue, 28 Mar 2023 02:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1679997508; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6MISSvCouqA9cx2hoXCbIEOFQ/tw2bO4d83GG2zGgvE=; b=H20nkFH8jnbFmpaVjh1mbdMO4PnytobUbAcaDCPto/03C4ZSTbY+dBC4tmYFmST1km zykxLgDoF1caGudo0a3QxXnlL+P+qXERqMeAiIKI+Hq9XX3I88mHJELZJPOcK/5oDtur 9rhlcQgPkOYYH+Rpz1WfPb5STPlj70eNgl8t2oDspeGD5ir09PKjJN/a+Hm9wQFdH5T+ YVSIPggQ4i1QJVlMX5D0t0a0dsnITytGDOauSV2E7FA+zkfCMr1QwTCU340iyfMcatKG EPZhtVAXiRY7SE/c6jr0IBlKdhly/WHs5rCG9a1ei8QvlvntAnPkhRKZu1E/c1/65Pb5 MkbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679997508; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6MISSvCouqA9cx2hoXCbIEOFQ/tw2bO4d83GG2zGgvE=; b=uBvHFUjZLsn5EqunOI4HvxR/PvLLZQbB++siotBhu+wM6XZjE+/o2F6Yw+O82ACmE1 gR+cFA/BGdkJCFcR5lSc70fe/1xrElXGxzxRiWy5XrNFPfvFa4berxVL9R/rCrCpKE4p HR98L+K1S53GBeFxATef1ZP3GEbDOtygC4QnCT0LewsjV16XF34FOtWO/04f/MSOkRtY kjKUyclwZ5h2B7vfYlTbTel/CApCdO9kdkUhZTFGyuZDO6mmwn/9uNhoblo/U3rvlWKY Cgm/Vk1LP5u04/4pPijvDUk1oIJldyXmnfTVc48XW/KK5KHOhicIN0mWWL3Ck93aclDg W9LQ== X-Gm-Message-State: AAQBX9cOlvFzZ4ut59AyDrVdObeOOzLAcyiI46FAQL0pJh7HBX4XJ5G+ MgmCPFs1CQGyHDO4k4PSNlLVCQ== X-Google-Smtp-Source: AK7set+cnJoJUdFAfbXEnGQHJUiqklLiq6LlORGWCRd1drU83/ieImpxAZqlIvMwNPK2C285YgpNgA== X-Received: by 2002:aa7:9629:0:b0:628:1274:4d60 with SMTP id r9-20020aa79629000000b0062812744d60mr15936639pfg.21.1679997507878; Tue, 28 Mar 2023 02:58:27 -0700 (PDT) Received: from PXLDJ45XCM.bytedance.net ([139.177.225.236]) by smtp.gmail.com with ESMTPSA id m26-20020aa78a1a000000b005a8a5be96b2sm17207556pfa.104.2023.03.28.02.58.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 Mar 2023 02:58:27 -0700 (PDT) From: Muchun Song To: glider@google.com, elver@google.com, dvyukov@google.com, akpm@linux-foundation.org, jannh@google.com, sjpark@amazon.de, muchun.song@linux.dev Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH 0/6] Simplify kfence code Date: Tue, 28 Mar 2023 17:58:01 +0800 Message-Id: <20230328095807.7014-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 X-Rspamd-Queue-Id: 6F94F4001E X-Stat-Signature: ss5ymkfsdw9hhahporj4kougmqymeftf X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1679997509-878009 X-HE-Meta: U2FsdGVkX18+BRx/Wy7vtV4QVdhKFSDaQm40dzg+qP0l+l1Qk7RyBqYwaFsMKKlSqYxcliGZGsDvXb5iq2TQTb11NrY0RqDkRKgP5VHSktCacxAUNsuBamoKkHYQ9cBXpRI97JsChe7KUTXZC/Ynz1s5J1YMfJj5wPoCC7/xPfZ21j015MNjnOXqNqE7K2S7Lbj8wBg6G+trvPogBQRnD5H6uhn58kGz26H1SSF/TKgjGTbTXklVq/nBa6z+20ctCGG87Fv32JXMDXxK/xgIbPmhGo2oZnzMLDRgvn/V/cF8W/+NkqHl1da3pQBF5FHh1fPKemt2RDJoOacEV4FyPjqhjItdM3vmYqyDipezViNylMCl5PdO3L/apz7bROhJbCtHfNdlZoPdroUuXl8wKPlHnPPat6uSOH5KcQBm8IMFfSbDG5cGZgZsQXvOY4iOlOXaIeD1hwvgU21ipc+isaGAVT/PQ8C33uCcqDTIHdCelhgrhcgV7jOPbiUyB3r3HWAGa/ZFEbyQ0Oi1cZbUG13hnJ99xU+i5KbeMsJP6MsK8xXy8RaxduY/IdaR0qigdRTOPYJ+ida5QN/3AOKRgk2AYduN0g1W/GRmZ5RmGBrLY0cGsWgrJlmB6zQEhjsVButk8u8ot3ZJVoTxRMG7zmwC0q/wbtkJekLWpbXeOcJ7kfMNAs75g8REk3WlvLIlDQIVh8D7c21mWctjwcX/Wglb4suXQJ8/OyzIEyNRKXsDGTYe5gjTX1S4o2cpiwLAMLL+Izqg/iFs6+M/hDvz3W7O9ovAcFf2hPDpn7AtEvzE+EDf3SWeKuXuXi//2UisQ4cpewip9yjxtSQBOfAreSTm7ES9034l4T3QqJDewmuhqLpKKYdxT4BlhT1s6v1uaFeNdQau+dychrCdJnr13u2F8AvjCOME3F3SYkTFgjr0kkIy0h4ezt+lP4VIWEoexbp039K4Zoo2gidPa1A cjsnMkiO q7sJNTpd+2qWDPng/fR679Eu/MKesmLEjXb8Re0UgTDP9/ZhNAg2qStCOSoRSTDUzBvObtGlp73NHIgFJMzdich9jaAUAZZ95h5u/zDmw0AJBoyKlJAz4SUUzD0lfgFcF7Izf0rLXyOfGYvJjkBHALPWoTd33V0QAced0cK5fnpozmXogNQTBkf7ccDPewQXcj5orYeEzI7zLRYOfj+ihmb4upLWKaVUF5QVXKILLQDQLWXEwJbCnDTQRWHOC4KEgSbQcQlUs2HgzFL6FT98HxZS0vgsk345VNShR8Z+NUS2SJeq5zMxebUUE5fFDs8/p+JZkC38UpiCq9BJazpDQpX3sgpwbWVIFeIjlAj53C5wrrceTIxpBk4VwDA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This series aims to simplify kfence code, please review each patch separately. Thanks. Muchun Song (6): mm: kfence: simplify kfence pool initialization mm: kfence: check kfence pool size at building time mm: kfence: make kfence_protect_page() void mm: kfence: remove useless check for CONFIG_KFENCE_NUM_OBJECTS mm: kfence: change kfence pool page layout mm: kfence: replace ALIGN_DOWN(x, PAGE_SIZE) with PAGE_ALIGN_DOWN(x) arch/arm/include/asm/kfence.h | 4 +- arch/arm64/include/asm/kfence.h | 4 +- arch/parisc/include/asm/kfence.h | 7 +- arch/powerpc/include/asm/kfence.h | 8 +- arch/riscv/include/asm/kfence.h | 4 +- arch/s390/include/asm/kfence.h | 3 +- arch/x86/include/asm/kfence.h | 9 +- include/linux/kfence.h | 8 +- mm/kfence/core.c | 229 +++++++++++++------------------------- mm/kfence/kfence.h | 2 +- mm/kfence/kfence_test.c | 14 --- 11 files changed, 89 insertions(+), 203 deletions(-)