From patchwork Fri Feb 10 21:15:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 5257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1181781wrn; Fri, 10 Feb 2023 13:20:04 -0800 (PST) X-Google-Smtp-Source: AK7set83ddVq7HKhEzrRtdytQJJr6tD2E4nvrrq3jgk4vSlndw31YQv3JS5F6RU7EfOV5nN6K9ly X-Received: by 2002:a17:906:801:b0:884:37fd:bf4c with SMTP id e1-20020a170906080100b0088437fdbf4cmr17625724ejd.19.1676064004250; Fri, 10 Feb 2023 13:20:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676064004; cv=none; d=google.com; s=arc-20160816; b=eDkCcbfSTbPHBUdEirzQTIaRujZCgEnLhrADNIyQKj0dEczQ9uLLNmG16HHkkJUFBR RgSHEk/yQTbmMVTcZZbdQ2WUSRhBEdFMSylonocPNnRHDUDS8EmWoxELnHfo6m9/9rHF nKlODVmWiPWUtBlsSJhreNK6bd+2vq9/emxit5Z7zyh6X49pyVbeHS04QAS2Dal+o/VJ mdqjOC834Z+PuJ5qoYh9n5SLRza6c2nM7ii0bunu/BoepVVZeJzFC3+EVwsX23OtKzF1 UhCeuZ5PV3FqSRg+Po3N+Pis6eFkMA3JA9dsx2JgcJb5g7A3zUw09s0/IdHKo/AdMuAY PcXw== 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:dkim-signature; bh=SVXQhPxtDUlvcBHu0yCHUaIQvvsOva2Wy+xT1T1B0xM=; b=zz/hW5qXsI33g1/cWkGHwhZIBb3RvvFUGoAc/pAAgMQ0fzFFshQdosXOg8PO4hkmL3 R1Cs48uBphCt7TuuZFk0DlQqNi5/ZomWp6NS4STc+lDvT5rqaEbWi+GHjmptB2CZAXkJ 1lVeBpGPReImIpdzXIIhXZSSUvgOL3uB998DhcQAkFXkd5q20/JYhjmK7eSZTx5xyDBH oOLgSv/R4vwizjFi1QbJ3CtbY1FXkoHOkcMf5bNOFsmsv1xyepLfONVJIDu5F5zC5Ffh zjuvJG7k8W9XzzEsRWqf5jkCDbAgVds2HVFESeZ50oItXP0VlGbgsdSplO56NKx6bORq /gjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=g4VXUY+C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ex18-20020a170907955200b00878cfc564bcsi5694658ejc.435.2023.02.10.13.19.41; Fri, 10 Feb 2023 13:20:04 -0800 (PST) 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; dkim=pass header.i=@linux.dev header.s=key1 header.b=g4VXUY+C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233825AbjBJVQP (ORCPT + 99 others); Fri, 10 Feb 2023 16:16:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232764AbjBJVQN (ORCPT ); Fri, 10 Feb 2023 16:16:13 -0500 Received: from out-234.mta0.migadu.com (out-234.mta0.migadu.com [IPv6:2001:41d0:1004:224b::ea]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B973F7536E for ; Fri, 10 Feb 2023 13:16:11 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1676063769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=SVXQhPxtDUlvcBHu0yCHUaIQvvsOva2Wy+xT1T1B0xM=; b=g4VXUY+C4aROZALZ/m0wYHFweJzqrsxkZpLJojP2JcL0petnwLSwd/Z80ClP+ddd1SJZoh pnPHpajSdtcvCOUCkJOlkWBGMudWmAo3OcCBtXiNOl6VhIkZijYh9/JJCDTrn4TmdQFaFl guDvrD9WiNbSsMPxQiXhHHsigN0sBeI= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v2 00/18] lib/stackdepot: fixes and clean-ups Date: Fri, 10 Feb 2023 22:15:48 +0100 Message-Id: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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?1757480489339346002?= X-GMAIL-MSGID: =?utf-8?q?1757480489339346002?= From: Andrey Konovalov A set of fixes, comments, and clean-ups I came up with while reading the stack depot code. Changes v1->v2: - Drop "lib/stackdepot: fix setting next_slab_inited in init_stack_slab", as there is no bug to fix. - Use "pool" instead of "slab" for memory regions that store stack traces. - Rename next_slab/pool_inited to next_slab/pool_required and annotate its uses with comments, see new patch #13. - Use STACK_HASH_TABLE_SCALE as a new name for STACK_HASH_SCALE. - Mark stack_depot_set_extra_bits as __must_check. - Only assign extra bits in stack_depot_set_extra_bits for non-empty handles. - Minor comment fixes. Andrey Konovalov (18): lib/stackdepot: put functions in logical order lib/stackdepot: use pr_fmt to define message format lib/stackdepot, mm: rename stack_depot_want_early_init lib/stackdepot: rename stack_depot_disable lib/stackdepot: annotate init and early init functions lib/stackdepot: lower the indentation in stack_depot_init lib/stackdepot: reorder and annotate global variables lib/stackdepot: rename hash table constants and variables lib/stackdepot: rename slab to pool lib/stackdepot: rename handle and pool constants lib/stackdepot: rename init_stack_pool lib/stacktrace: drop impossible WARN_ON for depot_init_pool lib/stackdepot: annotate depot_init_pool and depot_alloc_stack lib/stackdepot: rename next_pool_inited to next_pool_required lib/stacktrace, kasan, kmsan: rework extra_bits interface lib/stackdepot: annotate racy pool_index accesses lib/stackdepot: various comments clean-ups lib/stackdepot: move documentation comments to stackdepot.h include/linux/stackdepot.h | 152 +++++++-- lib/stackdepot.c | 654 ++++++++++++++++++------------------- mm/kasan/common.c | 2 +- mm/kmsan/core.c | 10 +- mm/page_owner.c | 2 +- mm/slub.c | 4 +- 6 files changed, 457 insertions(+), 367 deletions(-)