From patchwork Thu Mar 30 06:09:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Ge X-Patchwork-Id: 76904 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp907630vqo; Wed, 29 Mar 2023 23:17:34 -0700 (PDT) X-Google-Smtp-Source: AKy350bVfzoldtlea0HPy/60xT1XqBjaJ7RGKsH9mn17paDjojP8pUaGU5BDuQ2GxRw2g9UWOPfG X-Received: by 2002:aa7:9567:0:b0:625:caa5:67ee with SMTP id x7-20020aa79567000000b00625caa567eemr18005277pfq.19.1680157053553; Wed, 29 Mar 2023 23:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680157053; cv=none; d=google.com; s=arc-20160816; b=FmFXOJVN05S3lzZf8hGsl4RyvYriRhHuD+f2gAb/2EDXD+zdJfqmUdYXxGXxeACfnj WuPdjkLgaYY5LBJVR61fZZTKJtaIoP+7B2x8syNhigxEBw6TttpeqleXjp9KNyvPetN5 uWlj2N8HSo4bLeWUGm/M+T2rbrCej2rqitTRnzwDE5xxtyWImmmbGlA/9OOtvlULWVzf nYnxrB//rvlZknWaY+eQKAZgmV12HOAD03ErGtKruk7tK7Kc28nxja+rIJTuhoK2f0Yc nh9b9xLJEi5THI0QaAXFyzUItR3DCRzappUdZxRfGmdfZYkQH3aJPFCLB4PJBiK/Mn/V C28w== 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=kGd8DTaczYIEPI7GuNItYDlm+CZDDK7tjUQUdga4wFc=; b=F6Uai/eHUao/YdDNdvcew0JhMwb7v8T0OYskB4tnBfY5Uv22+Lfc24cnyHecRwix16 hrm6jruXa5PQLgdvT9ln2wqCX+orRvW99coRtW+GyT5MfOp5crvJiko8HHfTMB/ZjtH4 a68/XH+HOLFD/TVrzzOQY33AjPBwffLOygsRrvK660YGlJUIevXsHB3I9oPeEBFGlcr8 6VPN2yDgrNkA7gLL9wM35t1U5iydWjp5IG9j4YRt0FaCPmpict5cHuU/DI1SeKubJlYH NiQlkB2NbmTonu0zjC/0Z57rP4YJqzLOqMUJ3KVG8jxX3ljGc3Sfm2rl8sKyI34qxJdh /KzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y15-20020a056a00180f00b006281178b344si22859687pfa.244.2023.03.29.23.17.19; Wed, 29 Mar 2023 23:17:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbjC3GJh (ORCPT + 99 others); Thu, 30 Mar 2023 02:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230074AbjC3GJf (ORCPT ); Thu, 30 Mar 2023 02:09:35 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B898A40C8 for ; Wed, 29 Mar 2023 23:09:33 -0700 (PDT) X-UUID: 033a14a9cd8241bb9dfdbc7bef98356a-20230330 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:ebafa566-ce38-4805-b97e-5c459c92663f,IP:5,U RL:0,TC:0,Content:-25,EDM:25,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:0 X-CID-INFO: VERSION:1.1.22,REQID:ebafa566-ce38-4805-b97e-5c459c92663f,IP:5,URL :0,TC:0,Content:-25,EDM:25,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:0 X-CID-META: VersionHash:120426c,CLOUDID:491df029-564d-42d9-9875-7c868ee415ec,B ulkID:230330140918KLMIUS1O,BulkQuantity:0,Recheck:0,SF:38|24|17|19|44|102, TC:nil,Content:0,EDM:5,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: 033a14a9cd8241bb9dfdbc7bef98356a-20230330 X-User: gehao@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 39918076; Thu, 30 Mar 2023 14:09:17 +0800 From: Hao Ge To: akpm@linux-foundation.org, alex.williamson@redhat.com, jgg@ziepe.ca, akrowiak@linux.ibm.com, arnd@arndb.de, mark.rutland@arm.com, ye.xingchen@zte.com.cn, ojeda@kernel.org, alex.gaynor@gmail.com, me@kloenk.de, gregkh@linuxfoundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, gehao618@163.com, Hao Ge Subject: [RESEND PATCH] kmemleak-test: Optimize kmemleak_test.c build flow Date: Thu, 30 Mar 2023 14:09:04 +0800 Message-Id: <20230330060904.292975-1-gehao@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761772362611483048?= X-GMAIL-MSGID: =?utf-8?q?1761772362611483048?= Now kmemleak-test.c is moved to samples directory, if CONFIG_DEBUG_KMEMLEAK_TEST=m,but CONFIG_SAMPLES is not set,it will be meaningless. So we will remove CONFIG_DEBUG_KMEMLEAK_TEST and add CONFIG_SAMPLE_KMEMLEAK which in samples directory to control kmemleak-test.c build or not Signed-off-by: Hao Ge Signed-off-by: Hao Ge Signed-off-by: Andrew Morton --- mm/Kconfig.debug | 8 -------- samples/Kconfig | 7 +++++++ samples/Makefile | 2 +- samples/kmemleak/Makefile | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index c3547a373c9c..fb86e9952bac 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -249,14 +249,6 @@ config DEBUG_KMEMLEAK_MEM_POOL_SIZE fully initialised, this memory pool acts as an emergency one if slab allocations fail. -config DEBUG_KMEMLEAK_TEST - tristate "Simple test for the kernel memory leak detector" - depends on DEBUG_KMEMLEAK && m - help - This option enables a module that explicitly leaks memory. - - If unsure, say N. - config DEBUG_KMEMLEAK_DEFAULT_OFF bool "Default kmemleak to off" depends on DEBUG_KMEMLEAK diff --git a/samples/Kconfig b/samples/Kconfig index 30ef8bd48ba3..69076fbf3298 100644 --- a/samples/Kconfig +++ b/samples/Kconfig @@ -273,6 +273,13 @@ config SAMPLE_CORESIGHT_SYSCFG This demonstrates how a user may create their own CoreSight configurations and easily load them into the system at runtime. +config SAMPLE_KMEMLEAK + tristate "Simple test for the kernel memory leak detector" + depends on DEBUG_KMEMLEAK && m + help + Build a sample program which have explicitly leaks memory to test + kmemleak + source "samples/rust/Kconfig" endif # SAMPLES diff --git a/samples/Makefile b/samples/Makefile index 7cb632ef88ee..7727f1a0d6d1 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -33,7 +33,7 @@ subdir-$(CONFIG_SAMPLE_VFS) += vfs obj-$(CONFIG_SAMPLE_INTEL_MEI) += mei/ subdir-$(CONFIG_SAMPLE_WATCHDOG) += watchdog subdir-$(CONFIG_SAMPLE_WATCH_QUEUE) += watch_queue -obj-$(CONFIG_DEBUG_KMEMLEAK_TEST) += kmemleak/ +obj-$(CONFIG_SAMPLE_KMEMLEAK) += kmemleak/ obj-$(CONFIG_SAMPLE_CORESIGHT_SYSCFG) += coresight/ obj-$(CONFIG_SAMPLE_FPROBE) += fprobe/ obj-$(CONFIG_SAMPLES_RUST) += rust/ diff --git a/samples/kmemleak/Makefile b/samples/kmemleak/Makefile index 16b6132c540c..8a999ab43b6d 100644 --- a/samples/kmemleak/Makefile +++ b/samples/kmemleak/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_DEBUG_KMEMLEAK_TEST) += kmemleak-test.o +obj-$(CONFIG_SAMPLE_KMEMLEAK) += kmemleak-test.o