Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1991753pxb; Fri, 24 Sep 2021 17:18:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwksMVti58Lt/ECG4oFWmAZjXhBbkJBntEjQwJPPhvGpo23T9SdStfGVbtuPqtI8m5N7JOD X-Received: by 2002:a50:9d0f:: with SMTP id v15mr8244122ede.275.1632529098908; Fri, 24 Sep 2021 17:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632529098; cv=none; d=google.com; s=arc-20160816; b=xqfVokd8QuUL9yLUMnuhp6rwd6YWMf/Imft84FvHLeJZFLbcqesOyITRLCLzS7hfDv 4uSopa88Dbp2KRzzXrZsFY9oe2SCkhS8B3D/YRHz4EG56UmB7Dn7v4aA5V2S4ylGFimk Z10kPbu9Z3cB5EpS7DCHzoYcz9VGlPrbNzESgDpEhTw8PNF8WMU/YJb5OOeelcaPiHjS Bnv1FMm/C0eINHRGprJb367q2nEa3sUo/knOkl6XnxzS4khSiKK/rcCnh43l6FPsRqBz bHjpJ5T9nybjqqGxXrLWnfw3UFuLgBOgFuh0XGbRNO2a2RSm9pVpadP2dBGQwZ1MvA1Y NQgQ== 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=iXYkhMeF9PLQuzizpZgGLhqUPY0uM084km7200mmEzo=; b=kP3ZbNidDyp69kJBzumzMZiiGzFu8W9JpFEhgIVyfshsEWemN3CApt70+pu8N8kKJ6 uNk/gqgQz7jDxi/Hasf4EBwg5sjQlOv2kwNtsEgdCKQNxAomNADUPSoTe0ltXuO6jk6C /UyQJgGFmcHpBt9FCG1LBPJiEc+4BHtOgJgDEZEcYUfEM53aAO+sRsr+igQOWFvKAANo Mv3BBvfDS0Ma0q2/DHOxHxnQP9nXlMIxAY4m8fi0GV7RlJyT6AzZ5q6wEPwYKhnxcqA/ at/kn6ojrC96Kj6AF1+8j0L2SI0uSaJMrgaBhwyn08nVDgyuE5xRZIetqQIrZ91w532u 5Ouw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IXt7juzl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 14si9521750ejf.611.2021.09.24.17.17.51; Fri, 24 Sep 2021 17:18:18 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IXt7juzl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346146AbhIXNho (ORCPT + 99 others); Fri, 24 Sep 2021 09:37:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:51552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346184AbhIXNhZ (ORCPT ); Fri, 24 Sep 2021 09:37:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F045C6103D; Fri, 24 Sep 2021 13:35:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632490552; bh=1fmoLsZWNjPb0beZKghe3dr53sI70mX59svjbU6NF7s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IXt7juzlRuhLwMN7F4U1599smBRu8ztpPKuuGoIbe5jK08Y26k6mDnxz8kEL1QpmQ nmykxLZLFgGFByIOpqmYesOYkPmKEiTS4v4rjUbBOhAbLvohLXdysso2/jntLZdTiH vCXJbIVtWhoiMhGydD2Mx8NcHaLckhhMaLAhz4uGFyepa9eINXmygkxLZmeitcCtY7 qYZwC73BJMMXEihkTBLTO+B4/b4cBxNwMMC+/dRrlPJHuz330Dz1e7Vj7qPaXGtmUU oLlLqUgDSFFZnr/GCJBOU1uVFcZDeTch65pD8kMqgDd1y2prneZud8tRmCNpdT0QAV iEihUkmOGMBig== Date: Fri, 24 Sep 2021 22:35:49 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: Eugene Syromyatnikov , lkml , Ingo Molnar , Andrew Morton , Masami Hiramatsu , Mathieu Desnoyers , linux-trace-devel@vger.kernel.org Subject: Re: [PATCH 0/2] tracing: Have trace_pid_list be a sparse array Message-Id: <20210924223549.c41a89befe11534dfd56f01c@kernel.org> In-Reply-To: <20210924091627.645a8fd3@gandalf.local.home> References: <20210924033547.939554938@goodmis.org> <20210924000717.310b492a@rorschach.local.home> <20210924091627.645a8fd3@gandalf.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 24 Sep 2021 09:16:27 -0400 Steven Rostedt wrote: > On Fri, 24 Sep 2021 12:51:07 +0200 > Eugene Syromyatnikov wrote: > > Hi Eugene, > > > Note that there is only one top-level chunk (so its size doesn't > > matter much), (usually) about one middle-tier chunk (except for some > > heavy cases, since pids are allocated linearly), and quite some > > lower-tier bitset leaves. So I'd optimise towards smaller leaves at > > the expense of middle-tier (and especially top-tier) chunk size > > (especially considering the fact that in the kernel, buddy allocator > > is used), like 12-8-12 or something like that, but I have no factual > > What I really like about my 8 8 14 split I have, it makes everything 2K in > size on 64 bit machines (1K 1K 2K for 32 bit, but who cares ;-) > > 1 << 8 * 8 bytes = 2K // top tiers are pointers to lower tiers > 1 << 14 bits = 2K // lower tier only cares about bits > > This means they will likely all be allocated in the same slab. > > I'm optimizing the top tiers for size, because they are likely to be empty. > Why add memory for something that will never be used, and can't be removed. > Note, the middle and lower tiers can be reused when they go empty, which is > a likely use case (at least when I test this using hackbench). > > > basis for arguing about specific split. Also, I cannot resist from > > noticing that this reminds me an awful lot of XArray and [1]. Maybe, > > some wrapper around XArray would do? > > > > [1] https://gitlab.com/strace/strace/-/raw/master/src/trie.h > > > > I looked into xarray and it appears to be optimized for storing something, > where as I'm just interested in a sparse bitmask. I guess he suggested that store the bitmask in xarray. Anyway, both are OK to me. This is needed for reducing the memory. Thank you, > > Thanks for the review. > > Note, I'll be posting a v3 soon because I found if I echo 1<<30 into > set_event_pid, it adds 0 (because it only looks at the bottom 30 bits). > It should really return -EINVAL. > > -- Steve -- Masami Hiramatsu