Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp638248imw; Fri, 8 Jul 2022 09:04:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v+Jzhqh5eGrQUQfaSjBU9BnTAc7lVNzqudt6yR7UH/rH+zrCP12FJpJJgSCEoxCNFG9NPC X-Received: by 2002:a17:907:28d6:b0:72a:f121:b71 with SMTP id en22-20020a17090728d600b0072af1210b71mr4202651ejc.732.1657296251643; Fri, 08 Jul 2022 09:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657296251; cv=none; d=google.com; s=arc-20160816; b=0r0k6mJyJIp43thi2id7Zi824lspMWAXDXVc5qW2RNwOlEMDOzNwgThzzazFa5dlvc aNl/2TrT7hFIcEdLc/KuAz1KplgC6h26461VD25/usQfetUD80tDOk/miHlR/bWEM6gs kx5KymdiSejwQmHXpjbDMmOtpaOq7ellos/6D6wVU3RQF9J9QhaBQp6jK8e3zaBdOpM+ W+fCl8vX6bBsaKKzGPdMreRUiTa8E/O04VpX0N3kk397q1BLU4Gcz3/1PG7IK2Hban+L 5+uEUB+IKnYtUq5h01KLAmECY/z5+dyypD9kBq8HsNIsVebEcgBQUuzHctoUm7MpZSPK bBMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=8Q2U10fVxflJg1wRLdlpzwKmLUZ/H+6ZbjlQlytlu3A=; b=MK59DfrOGyUFklJvsoxRhu/aZeqSoWgvgvfPwVoK2FE0M/EfGT6GJh/66wTjtq9JR8 JXZvEZuGt+fNNTqNPL098Rl5FwTO4kez3FdfdwCD1SNk23E2YM4WKbeY5QM/6VUk9ZGh cyjj3IKM86I/Gho3M0y18ejhNP4LKnS+0C51l2/d2iWnfKa4747EOiEjCfHYg/tttNdc UaCXaJa4eeTkRjNS/IFnhAonBBQXGhH647LNfnviMlE5RvSJll4AZ6QCG5phFs6ZVps1 AC//bxCJKGi+hzRyH8cKPqf9HR/eOb+6eUc5OsM8/AHrLWG9WLGQRRf8KFb1vE3s29UI t9Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pJRgOhPV; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020a0564021f0b00b0043a9041dd22si9783199edb.297.2022.07.08.09.03.32; Fri, 08 Jul 2022 09:04:10 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=pJRgOhPV; 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 S238690AbiGHPfG (ORCPT + 99 others); Fri, 8 Jul 2022 11:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238613AbiGHPfE (ORCPT ); Fri, 8 Jul 2022 11:35:04 -0400 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 113951A3A6; Fri, 8 Jul 2022 08:35:03 -0700 (PDT) Date: Fri, 8 Jul 2022 23:36:06 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1657294501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8Q2U10fVxflJg1wRLdlpzwKmLUZ/H+6ZbjlQlytlu3A=; b=pJRgOhPVgBRx5k/MVV3WVOImpOZpAmgGUHRC8Xe6Yp0ObR686Ffe1OFZFNoD8VisQ6GmQQ StZiq1oHCeETbNXCHZKSeUJxMnZ0xy85ksgkew4ADsAcnC/Y9KbDhojByL3ea13S7/mV92 /j4QlyOQCmKHb86QCySPxf+vSsWkbiM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Tao Zhou To: Matthew Wilcox Cc: Daniel Bristot de Oliveira , Steven Rostedt , Wim Van Sebroeck , Guenter Roeck , Jonathan Corbet , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Will Deacon , Catalin Marinas , Marco Elver , Dmitry Vyukov , "Paul E. McKenney" , Shuah Khan , Gabriele Paoloni , Juri Lelli , Clark Williams , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Tao Zhou Subject: Re: [PATCH V4 01/20] rv: Add Runtime Verification (RV) interface Message-ID: References: <60548902dbccaa7ba420e40e46835693e27f643f.1655368610.git.bristot@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, Jul 06, 2022 at 06:53:21PM +0100, Matthew Wilcox wrote: > On Thu, Jul 07, 2022 at 01:49:02AM +0800, Tao Zhou wrote: > > > +struct rv_monitor { > > > + const char *name; > > > + const char *description; > > > + bool enabled; > > > > Can the 'bool enabled;' be put at the end like the definition of > > structure rv_monitor_def. If '8+8+sizeof(bool)+8+8+8' not the same > > as '8+8+8+8+8+sizeof(bool)', I mean is it possible that after the > > end of stucture there is a int or char not require to align to 8 as > > an example from my nonsense. > > That will make no difference at all. C doesn't allow other variables > to "fill in the hole" at the end of the structure like that. For > example, one could legitimately do 'memset(&rvm, sizeof(rvm))', > and that would wipe out those other variables as well. I mean if it is possible that if @enabled placed at the end of the structure rv_monitor will save some bytes. If @enabled place in between, the next function pointer which is 8 bytes will align to be in x8 address and the size of structure rv_monitor is larger than been placed at the end of the structure. Or the compiler can do magic that I can not guess. Sorry for my late reply. I am not sure about this. But your reply is not about what I mean. You say that the size of structure is the same(I doute about this). But what my concert is that the other data next to the structure rv_monitor how to align if placing the @enabled at the end. Place in between, bytes: 8+8+8(padd)+8+8+8=48 Place at the end, bytes: 8+8+8+8+8+sizeof(bool)=? ? is small than 48 and the data next to the data structure rv_monitor can use the saved byte which is the result of placing @enabled at the end of structure to place the data.