Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp762700pxp; Fri, 11 Mar 2022 14:28:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNhPqak/ttFqjQCkW3iHWjeRiOfOT3mz2q1qith6U4DpxMQkiCPg0rAOvtUz9bC+zKiRpE X-Received: by 2002:a17:90a:c252:b0:1bc:52a8:cac8 with SMTP id d18-20020a17090ac25200b001bc52a8cac8mr23833719pjx.61.1647037680778; Fri, 11 Mar 2022 14:28:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647037680; cv=none; d=google.com; s=arc-20160816; b=lb0r06uc3rn5hX/sqS2yV1fpG7R4p3ZAcJjtnGF+bh48A07S3hBlqFrm7lEtfRBdp3 tT1g5ftXW+cACN0JDMIY3JSvlCpUax7TeT29Hf7PWN/A7YGgHLoS6DHhPO6XcFRPn1/B JeFi9BMfuUKCAKVfVmj4GrFfQD/M+0Zo0z+4W21ndypZ4mh/4td0rup89ZGdAh3o+lpW BIuJ+O1u6r6vI0aA779G6Wi+W86p8uhXf4ZXxFfErETNarHMEbeXPkrmw00Gyd/7azq7 i/L2TiL87fAoCZIZU1/x+Zs/lx5J0x5IeRksjm2AMPcPT+gcPFc6LpU0g8gyjWpzmS9A gW7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=grwJQHpTejzQ9PPbrhyRjQ3f2c8M8MaXreOB3JRCzH4=; b=pmXP2LzW0uTfHDIwqwhFVyCJmMxUsQhz445vPmoiGeS8NapJKUVeoOQUypljcFA3Hb peZXErtpPPlI8MeXczWdwwU/2STADinDQJwFbtqLkfURA/dPRgTTYcFszm3TZ94Dm56B BTKF1rBBtZAPp/TQipuvd2Bnj7/p5ZVUBDKPwNYjpyRgcbwD5I3bL3mlr3Fhw4kNDzCJ 6npYLnqV6GiLtce/NaVPZu+Vrv3a5Z6YRx0DCXKme305cDVQSzVezK0WTKQuyC4JzIid bvOMU8HAYLvh/CfoUbWgpGq3TGxtEF8VgGUtkgh5+sZ+0PZFJ0bFTQtjHSk2w9/q000f MQCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=XHp3iURq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id v63-20020a638942000000b00380ba34942asi8244060pgd.322.2022.03.11.14.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:28:00 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=XHp3iURq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ECDD030F790; Fri, 11 Mar 2022 13:36:02 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233634AbiCKSmc (ORCPT + 99 others); Fri, 11 Mar 2022 13:42:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236217AbiCKSmc (ORCPT ); Fri, 11 Mar 2022 13:42:32 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CDAAE2350 for ; Fri, 11 Mar 2022 10:41:28 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id z26so13194727lji.8 for ; Fri, 11 Mar 2022 10:41:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=grwJQHpTejzQ9PPbrhyRjQ3f2c8M8MaXreOB3JRCzH4=; b=XHp3iURq9OeJVvf+OfCRzT7E/cMt2KAuZNAwrYLyP/pzLenBGQ8uLEBnp3WmTUS8nh xRLufqDVNmGWux/1S1hgA4vH49obaGQ9jwyXIaQ1y0Zy8eIP792BUl2Cewf+liru22iE i3hJ3p85HmBfcmjySUXC47mkMZJ5BchuXf6Xk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=grwJQHpTejzQ9PPbrhyRjQ3f2c8M8MaXreOB3JRCzH4=; b=tdVebKnAo3eyBxoared6Us/czQHwI+fvt7NxCaFyiadO0/c/MwzcUSRa+fHiViq5RF hXjMPrZ7C725XxD3TC4HL1CACCMwjrWuuwTYNZdpvdLoQlrAPNQSu++RR4+ZkDChdDv8 Z6GjJQgg9rdQM7zDdpD4KfY9VdBRuPo9vFXPUZD+vyn9hfD/GiB/bWtuBhBy28EbxtEW iL3NfrAH7wXkGJYfZHAjzHopDPTcllz5VV9F//O1pb6cEV50mDNZJUBJxoDIyzhIYsi8 9btjP3gTuraJ8f8MYHXK4EpuibMg9aH65bbSAY4hFv9X/SQpHBgKgLibqBxLrZqHzcuw nxvQ== X-Gm-Message-State: AOAM530tCDjnCfI63+a5aqKUqxOKxCA1bNKs3uJphsNS0O8Rs81MGHeQ DW6pOQKCCQ+BvD7je7DXwH44ldyG8I4blkGaZM0= X-Received: by 2002:a05:651c:11ca:b0:247:f32e:10ba with SMTP id z10-20020a05651c11ca00b00247f32e10bamr6937694ljo.208.1647024086467; Fri, 11 Mar 2022 10:41:26 -0800 (PST) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com. [209.85.167.45]) by smtp.gmail.com with ESMTPSA id h6-20020ac25d66000000b0044315401373sm1746550lft.29.2022.03.11.10.41.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Mar 2022 10:41:23 -0800 (PST) Received: by mail-lf1-f45.google.com with SMTP id bu29so16655343lfb.0 for ; Fri, 11 Mar 2022 10:41:23 -0800 (PST) X-Received: by 2002:a05:6512:3a83:b0:447:da72:43f1 with SMTP id q3-20020a0565123a8300b00447da7243f1mr6931391lfu.542.1647024082921; Fri, 11 Mar 2022 10:41:22 -0800 (PST) MIME-Version: 1.0 References: <20220304025109.15501-1-xiam0nd.tong@gmail.com> <20220311142754.a3jnnjqxpok75qgp@maple.lan> In-Reply-To: <20220311142754.a3jnnjqxpok75qgp@maple.lan> From: Linus Torvalds Date: Fri, 11 Mar 2022 10:41:06 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/6] list: add new MACROs to make iterator invisiable outside the loop To: Daniel Thompson Cc: Xiaomeng Tong , Arnd Bergmann , Greg Kroah-Hartman , Jakob Koschel , Jann Horn , Kees Cook , Linux Kbuild mailing list , Linux Kernel Mailing List , Linux-MM , Netdev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Fri, Mar 11, 2022 at 6:27 AM Daniel Thompson wrote: > > It is possible simply to use spelling to help uncover errors in > list_traverse()? I'd love to, and thought that would be a lovely idea, but in another thread ("") Barnab=C3=A1s P=C5=91cze pointed out that we actually have a fa= ir number of cases where the list member entries are embedded in internal structures and have a '.' in them: https://lore.kernel.org/all/wKlkWvCGvBrBjshT6gHT23JY9kWImhFPmTKfZWtN5Bkv_= OtIFHTy7thr5SAEL6sYDthMDth-rvFETX-gCZPPCb9t2bO1zilj0Q-OTTSbe00=3D@protonmai= l.com/ which means that you can't actually append the target_member name except in the simplest cases, because it wouldn't result in one single identifier. Otherwise it would be a lovely idea. > For architectures without HAVE_LD_DEAD_CODE_DATA_ELIMINATION then the > "obvious" extension of list_traversal_head() ends up occupying bss > space. Even replacing the pointer with a zero length array is still > provoking gcc-11 (arm64) to allocate a byte from bss (often with a lot > of padding added). I think compilers give objects at least one byte of space, so that two different objects get different addresses, and don't compare equal. That said, I'm not seeing your issue. list_traversal_head() is a union, and always has that 'struct list_head' in it, and that's the biggest part of the union. IOW, the other parts are (a) never used for anything but their type and (b) will not take up any new space that isn't already used by the list_head itself. Linus