Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D80BAC6379F for ; Tue, 14 Feb 2023 15:01:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233510AbjBNPBR (ORCPT ); Tue, 14 Feb 2023 10:01:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229773AbjBNPBM (ORCPT ); Tue, 14 Feb 2023 10:01:12 -0500 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36DE72A9B9 for ; Tue, 14 Feb 2023 07:01:03 -0800 (PST) Received: by mail-qt1-x82b.google.com with SMTP id cr22so17664943qtb.10 for ; Tue, 14 Feb 2023 07:01:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=IWClI4gmqGN4DlU8lND230mPm2ROhEH1JY/mvbe9IGY=; b=ef6d2jKYU3nPPxyVbosZ51CBYb7roCJPlQ4NryeZdFF13Tr3ltLwWFXTWmtAfy28GR aYXpVWl3dUDp8fe0SpOb3qwZ375nxS9u6ugpwY8FBLDtS7rUKDm/4Pn8QIpAcziR7ezW 2Cc/1QSN5NFq2iYp/zMY2AZvdk4VP3kxJ3kSmp8w9X3RXDj4+kQFK6wwFcN1H8z9+0MB uvPww2oce5T06kjF/x9cD3weEOOs/5dOR/lMPdaeDnYsLWH0d59D++bu+Vylfx0vdRZb 0M6xtSMqfk3NP3p3mCsmbYfl1O2nxDxd2FIc0NvxAyrlBLJJwAT2VsKdK1jN4dpa7BoV Jv+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IWClI4gmqGN4DlU8lND230mPm2ROhEH1JY/mvbe9IGY=; b=ChtyRGu6zAi/by7FrD9W5CI55StZe7Xn2+Lzug1UuzMgNwSoLrJFir2M3fDCQBs/ln EViwZ0puhBpccDV0G8XKRb6uw9LQDsFCvBzblp/PoL4WZlidL1rjtMEmwXi+s1WT17UL OXOCxtr7z7gHlloF/OIIGKWeKs9J3a0xCD/4oMewTb8zG3EmxggJ22uo8XcSi7yWiYBc dyjPZcc1ekT48OIn5eQQl+TALwWs6sC81aR1kMIiVsrVPUbxNcRq+rFj7mEv8sNYTcRW KwYGyMuPSFheRLYMxe0bJ1u7dScjQ3U+hRmQKGpoh2ixBkxODLi40+WMhAfUkTI0nLEs dnyw== X-Gm-Message-State: AO0yUKV/Q08rP17VaKGphjziMCKQKMPZae4X0ARW0WxehNAKxL+M5UZO zl7IgAx8t7ji3/H+iUvbqCsoGLuBoRv6SjNf X-Google-Smtp-Source: AK7set8/INvNdj6TDxgd7rqMzcASY2jtFBOsamVV51VAlU7OICrs7+stQvx8HLmwXKP0SYGLlqLFRA== X-Received: by 2002:ac8:4e45:0:b0:3b8:2e36:efd with SMTP id e5-20020ac84e45000000b003b82e360efdmr4837930qtw.55.1676386862310; Tue, 14 Feb 2023 07:01:02 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-167-59-176.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.167.59.176]) by smtp.gmail.com with ESMTPSA id p19-20020ac84093000000b003b6325dfc4esm11200235qtl.67.2023.02.14.07.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 07:01:01 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1pRwnk-000RYJ-T3; Tue, 14 Feb 2023 11:01:00 -0400 Date: Tue, 14 Feb 2023 11:01:00 -0400 From: Jason Gunthorpe To: Christophe JAILLET Cc: Leon Romanovsky , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-rdma@vger.kernel.org Subject: Re: [PATCH] RDMA/restrack: Reorder fields in 'struct rdma_restrack_entry' Message-ID: References: <75480cf9-8d06-7a7d-4624-6ddbb7d6053a@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <75480cf9-8d06-7a7d-4624-6ddbb7d6053a@wanadoo.fr> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 14, 2023 at 03:34:21PM +0100, Christophe JAILLET wrote: > Le 14/02/2023 à 14:08, Jason Gunthorpe a écrit : > > On Tue, Feb 14, 2023 at 01:53:52PM +0100, Christophe JAILLET wrote: > > > diff --git a/include/rdma/restrack.h b/include/rdma/restrack.h > > > index 8b7c46daeb07..da53fefe6f9e 100644 > > > --- a/include/rdma/restrack.h > > > +++ b/include/rdma/restrack.h > > > @@ -80,6 +80,10 @@ struct rdma_restrack_entry { > > > * query stage. > > > */ > > > u8 no_track : 1; > > > + /** > > > + * @user: user resource > > > + */ > > > + bool user; > > > > Can we combine this into the bitfield above? > > > > Jason > > > Hi, > > and even above, we have > bool valid; > > I wanted to keep the changes as minimal as possible, but I can change them > all in a single bitfield. IIRC it needs to be checked, I vaugely remember valid can't be a bitfield because it is an atomic > Do you want code such as: > static void rdma_restrack_attach_task(struct rdma_restrack_entry *res, > struct task_struct *task) > { > if (WARN_ON_ONCE(!task)) > return; > > if (res->task) > put_task_struct(res->task); > get_task_struct(task); > res->task = task; > res->user = true; <-------- > } > > to be changed with 0/1 instead of false/true? I'd keep with true/false Ideally the bitfield itself would be bool type too > Apparently gcc 11.3 is fine with using true with u8:1, but I don't find it > really logical. Bool types can be casted to integers in defined ways, it is pretty normal. Jason