Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp73872rdh; Sat, 23 Sep 2023 01:58:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKoKcOt5wzg5LYr2Tclsr/IL62PFrays5DLVWYiJ7pdCSWNXyi+emnBTzdGLNMjhGc3Qrx X-Received: by 2002:a17:902:f812:b0:1c5:6f3c:94fe with SMTP id ix18-20020a170902f81200b001c56f3c94femr1154438plb.69.1695459505672; Sat, 23 Sep 2023 01:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695459505; cv=none; d=google.com; s=arc-20160816; b=ETTeWVhhZw+CRd+6dx252t2G4etScxhV3m6oGpRgtgfwgu63LZQBgtln+KTHUOspZ9 KHzjpJYXEep1ZqDsd2+yg5gc9QNXzXMnnD4gemlb8n9sFaEDOYJyF6ID1RgFIP63AejY HnzqzmnD2kvGvn6NXoCLg1AebW+XgA3D7K+cAdxnG0ZcDnNzGy2iRzw0w2FLkhwWuaNL GriGZmOYnHW1gfrxk2wrXWvFTo1dsGyzmcEXkz6RuFK9YjQnP43XUxs3vcRqJUARbVdU ea0wzw+vqcJndnaXv1UAJEloBsBU9UvhZ4prLhMrHt8WPUGGIOYFswIJGfLHUP6qoHOd hOnQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=DRP/JmKa4erIhQhIwlib167/c+vERYHGJc+bG6h2aKA=; fh=Gzkq4XViazw64oKbiDJd7FznSCeNRSCJjuAJV0jclYw=; b=AO+65aNzA8Se+8E3FWnNAGPdia/VsuQWq4ouGH4bzJdpUh0sh1bON8/nb+2DSqDCCc rfXpfPZ5bEgof73yRdOAOP4zRKlSHFF2KNzTtwuZ3fTbDy0ZOvUKGa3eIi9TTOJ23S5e BSSGtu0cSF5+zsQyifvxMqKNqbbvr6aC0QEzshpnFbj2poFGMgpVTt72RSK5vtFHdYnt GG9BlO3i8Mwb5sI05g7CuWeCjldCZbKYrea3o/OYj+ZBD0/A2jZw5uDHtAkW2OJi2I4q q1QzfB77zFN4jpvIfLFwmdLJR8NhQx2LZeTsd8sDK0HLc20mezsxlyON6spKscDz0Nf4 wbPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XujPLn2p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id o9-20020a170903210900b001c43fce9c7asi5215118ple.444.2023.09.23.01.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 01:58:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XujPLn2p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 123438325193; Sat, 23 Sep 2023 01:58:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230525AbjIWI6E (ORCPT + 99 others); Sat, 23 Sep 2023 04:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbjIWI57 (ORCPT ); Sat, 23 Sep 2023 04:57:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BC34196 for ; Sat, 23 Sep 2023 01:57:53 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87DC8C433C8; Sat, 23 Sep 2023 08:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695459472; bh=B5iJK8d6K4hWUoky1Er/Avif20xo+seTHte0YQPQhEM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XujPLn2psJEGWQtIsNS1J7Oi5htuRC+mCdPf43HFye5Mg1FjNoldDrRh0VFSy0ERe iXvHRC8XzLjNi5iRfuocQwqCzymOSiuTN+8A44axl1JeFn5/2HeVhAuu/Pc7G143ZJ nk6EKBFyE25snL1OEDEYgWbxVmxGgc5oOo6hUYFxrcWtzhMrKSmpoXZoLy5w/biopx FfnUMAwsUIsRlzQGM0rbYHLR3u6UpigGWPe6/omjlYP69OAzSo4qjqirSgbI9WvRm0 8CzqPBBRt7kFgmceWQxTqsWSzwmoe9DQm6nHwDhXNc6Q+a/t1gCsBjZPj7oCSh6fxD CIxDlQ+x6uIKQ== Date: Sat, 23 Sep 2023 17:57:46 +0900 From: Masami Hiramatsu (Google) To: "wuqiang.matt" Cc: linux-trace-kernel@vger.kernel.org, davem@davemloft.net, anil.s.keshavamurthy@intel.com, naveen.n.rao@linux.ibm.com, rostedt@goodmis.org, peterz@infradead.org, akpm@linux-foundation.org, sander@svanheule.net, ebiggers@google.com, dan.j.williams@intel.com, jpoimboe@kernel.org, linux-kernel@vger.kernel.org, lkp@intel.com, mattwu@163.com Subject: Re: [PATCH v9 0/5] lib,kprobes: kretprobe scalability improvement Message-Id: <20230923175746.da3ab516a5c17c5d1897d6d6@kernel.org> In-Reply-To: <20230905015255.81545-1-wuqiang.matt@bytedance.com> References: <20230905015255.81545-1-wuqiang.matt@bytedance.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 23 Sep 2023 01:58:23 -0700 (PDT) Hi Wuqiang, I dug my mail box and found this. Sorry for replying late. On Tue, 5 Sep 2023 09:52:50 +0800 "wuqiang.matt" wrote: > This patch series introduces a scalable and lockless ring-array based > object pool and replaces the original freelist (a LIFO queue based on > singly linked list) to improve scalability of kretprobed routines. > > v9: > 1) objpool: raw_local_irq_save/restore added to prevent interruption > > To avoid possible ABA issues, we must ensure objpool_try_add_slot > and objpool_try_add_slot are uninterruptible. If these operations > are blocked or interrupted in the middle, other cores could overrun > the same slot's ages[] of uint32, then after resuming back, the > interrupted pop() or push() could see same value of ages[], which > is a typical ABA problem though the possibility is small. > > The pair of pop()/push() costs about 8.53 cpu cycles, measured > by IACA (Intel Architecture Code Analyzer). That is, on a 4Ghz > core dedicated for pop() & push(), theoretically it would only > need 8.53 seconds to overflow a 32bit value. Testings upon Intel > i7-10700 (2.90GHz) cost 71.88 seconds to overrun a 32bit integer. What does this mean? This sounds like "There is a timing issue if it's enough fast". Let me reivew the patch itself. Thanks, > > 2) codes improvements: thanks to Masami for the thorough inspection > > v8: > 1) objpool: refcount added for objpool lifecycle management > > wuqiang.matt (5): > lib: objpool added: ring-array based lockless MPMC > lib: objpool test module added > kprobes: kretprobe scalability improvement with objpool > kprobes: freelist.h removed > MAINTAINERS: objpool added > > MAINTAINERS | 7 + > include/linux/freelist.h | 129 -------- > include/linux/kprobes.h | 11 +- > include/linux/objpool.h | 174 ++++++++++ > include/linux/rethook.h | 16 +- > kernel/kprobes.c | 93 +++--- > kernel/trace/fprobe.c | 32 +- > kernel/trace/rethook.c | 90 +++-- > lib/Kconfig.debug | 11 + > lib/Makefile | 4 +- > lib/objpool.c | 338 +++++++++++++++++++ > lib/test_objpool.c | 689 +++++++++++++++++++++++++++++++++++++++ > 12 files changed, 1320 insertions(+), 274 deletions(-) > delete mode 100644 include/linux/freelist.h > create mode 100644 include/linux/objpool.h > create mode 100644 lib/objpool.c > create mode 100644 lib/test_objpool.c > > -- > 2.40.1 > -- Masami Hiramatsu (Google)