Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1176927pxb; Thu, 23 Sep 2021 21:08:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzunXL5OgIPomBEV7jQcf9LxiF4jDGPtqTxFKyg1zJ3gKwEKjGnyGoanasgZH02IRet/Pd X-Received: by 2002:a6b:400a:: with SMTP id k10mr6662065ioa.155.1632456503427; Thu, 23 Sep 2021 21:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632456503; cv=none; d=google.com; s=arc-20160816; b=MOhkz4TrfK2iWIu8nO8uzClATse2sWDITEtLChOsTvvmXtjPVLFA2QfYdlE+BrQLp0 Lm96oE2RF3PbwSdGHcIFXMbR0tinU5/Wp9uuH/lUPMIPhTgg8sXCHieR7fVUv4YI0KSb ZXu7222Hlz/fo61HvRcC14GkGJp4LUG76VUjC9Kd1ju+krPxh4QFnIcIXldkpy1oFLvP I0M4ArsQ1mGRulEARj3Mql3NihKh7TTb5VgFEYa6UUDnQLzBke5FUD7RjgQGPQTh4SXH UWDul6QQkXA4gwbL2JxrBLFLnlinLWeQAu6MyR5EHu2/5kcg5VcqYZVbnHpTr0jfP4B/ D7yg== 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; bh=WAIhoJcOUB+5mMhb8+MNuK+Q4r/93AGLNi6t4PC7Ps4=; b=RGWqQ/3vdcR/JD6158M6ovYhXdzYsVIxVmD+4UHF9z/msYle5oH4wT8vTDSqt7EGBM HIo0iN2VsgFWARlU0U5G2iFdvSiNNLvqdx007z7OCvcGhZIFc65b2FuNoXRQ542oNcGK Mpl5f8RwxaClaL+5NAjgEf8AhwH3SWPyE7aXymX5FgNz3vJQ9Vsm1zdGRYjCwdfvThqJ gqDXadtV+c+CMfw/sOteENegDDiK3hlX0i7SCb4oekhf6MK33JOBZ6cbR+cW+q73BKxS KnqBsP6W60BjxRkNdrowiY0n6WrzKwTAkJHjLeiXWRxTyQniewNiqTD9s7A+5FAj41On KseQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si9184054iov.39.2021.09.23.21.08.08; Thu, 23 Sep 2021 21:08:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbhIXEIw (ORCPT + 99 others); Fri, 24 Sep 2021 00:08:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:42492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbhIXEIv (ORCPT ); Fri, 24 Sep 2021 00:08:51 -0400 Received: from rorschach.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DDCE2610C9; Fri, 24 Sep 2021 04:07:18 +0000 (UTC) Date: Fri, 24 Sep 2021 00:07:17 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: 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: <20210924000717.310b492a@rorschach.local.home> In-Reply-To: <20210924033547.939554938@goodmis.org> References: <20210924033547.939554938@goodmis.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; 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 Thu, 23 Sep 2021 23:35:47 -0400 Steven Rostedt wrote: > The pid_mask will start out with 1024 entries for the first 10 MSB bits. > This will cost 4K for 32 bit architectures and 8K for 64 bit. Each of > these will have a 1024 array to store the next 10 bits of the pid (another > 4 or 8K). These will hold an 512 byte bitmask (which will cover the LSB 12 > bits or 4096 bits). Thinking about this more, I should adjust this split. Currently, this is a 10,10,12 split, but since the upper chunks are arrays of pointers, and the lower chunk is a bitmask, and that pids tend to be close together, I should make the lower split bigger. As a 4K page is 32768 bits (2^15), the lower split should be 15 bits, not 12. This will probably allocate better. Of course 32 - 15 is 17. So maybe to keep it simple, by having the two upper chunks still the same in size, I could have it be 14 bits for the lower (2048 bytes). And since pid_max can only be 2^30, we don't even need to cover the full 32 bits. 30 - 14 = 16 = 8 * 2. Then I can make the upper chunks cover 8 bits (arrays of 256 pointers) and the lower chunks cove 14 bits. This would coincidentally make all chunks 2K in size (on 64 bit machines). Hmm, in that case, I can make the lower and upper chunks use the same memory and not separate them. They are unions after all. But that may be unfair for 32 bit machines, as the upper chunks are only going to be 1K in size for them (256 * 4). -- Steve