From mboxrd@z Thu Jan 1 00:00:00 1970 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 6598AC433FE for ; Fri, 20 May 2022 11:16:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244504AbiETLQO (ORCPT ); Fri, 20 May 2022 07:16:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348460AbiETLQE (ORCPT ); Fri, 20 May 2022 07:16:04 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28908201AE; Fri, 20 May 2022 04:16:02 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id h13so1226896pfq.5; Fri, 20 May 2022 04:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cSj1iULxPa/Q17vQx9CvBh+XXwbDyu32iNxH8BDHGWo=; b=KAl6JiUblhGNLjQZ5H0XrsEH9sR+zAIGiIrYCvRSOx3z++Jx75Eil0AfqhCM8BbmPR qPbECuxldaypu17UE9fgu89sGfMl+EohW1msxEf6R+k1ZrxamBnRam6cYcJcx7mXGEqg g/6VIVWY73HuktEyJ9EyJCB4Lddi2viqjElMH2ai6Q9L+7nv7ma1iOTRAbMr0jGRP0sT T2ga5r8esXHAIG+CzKW2Pt1e8LuhbOIyKuceUi9Yu5OgSv+9+TSt7xFSfM1lI8rZhdxQ aVEFgCYfivV/FDw3ekn39hJpjJ8YmEZ/SpoeZdUduz+g+kLNR+zul2CDNo3FNVhbchS9 tEIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=cSj1iULxPa/Q17vQx9CvBh+XXwbDyu32iNxH8BDHGWo=; b=0w88yCrOL04HwqV5gLOWjIFgDP0uBZPSjC4HwA7j7jzwRJIzIgVsdCu4FqViL5FvQ7 MNx4wNSizTpF209qV+DHVEoP95X2w3Oue2vdTgjoHn1uoNT0zBE5ey+NnxVvjTvQxGIi FDpQ+BsXBxUCs3PottXCEglZsGEwypRbBNAOSDSlcyM3qk6Z3/QYMuZg9a90/aHCLiEb DVooyjnx2J+WFfjceGq2+HaMmEKglBxerSlh4zYRyXzfQwxTQWYP2LwXX7Bo3SyTrauX 6fXCAmAgYqz/g5jGzkmoszWQNZoVvcdXyJa9i55zjq9j7V6iH6GxHd1UfKAYh4nJh+lj mwiA== X-Gm-Message-State: AOAM533hze85FmLKL61QQUsktWisM+oV9UFKK+YoiqhPPoLb2qMRJLJM t1ggoNEy1QLTAwV2bwTj8dy3j/VAgKk= X-Google-Smtp-Source: ABdhPJyqsW819iNKjHVYIQggrJBIiy7DKH8+i2ACo/uPCYVrkPdFb8BHaiKm7RUnHS5MzQbqtCRdew== X-Received: by 2002:a63:1a1d:0:b0:3f5:eb02:b6b4 with SMTP id a29-20020a631a1d000000b003f5eb02b6b4mr8196749pga.343.1653045362244; Fri, 20 May 2022 04:16:02 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::4:1761]) by smtp.gmail.com with ESMTPSA id y6-20020a62ce06000000b005082a7fd144sm1559042pfg.3.2022.05.20.04.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 04:16:01 -0700 (PDT) Sender: Tejun Heo Date: Fri, 20 May 2022 01:16:00 -1000 From: Tejun Heo To: Kumar Kartikeya Dwivedi Cc: Yosry Ahmed , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Zefan Li , Johannes Weiner , Shuah Khan , Roman Gushchin , Michal Hocko , Stanislav Fomichev , David Rientjes , Greg Thelen , Shakeel Butt , Linux Kernel Mailing List , Networking , bpf , Cgroups Subject: Re: [PATCH bpf-next v1 2/5] cgroup: bpf: add cgroup_rstat_updated() and cgroup_rstat_flush() kfuncs Message-ID: References: <20220520012133.1217211-1-yosryahmed@google.com> <20220520012133.1217211-3-yosryahmed@google.com> <20220520093607.sadvim2igfde6x22@apollo.legion> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220520093607.sadvim2igfde6x22@apollo.legion> Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, May 20, 2022 at 03:06:07PM +0530, Kumar Kartikeya Dwivedi wrote: > With static noinline, the compiler will optimize away the function. With global > noinline, it can still optimize away the call site, but will keep the function > definition, so attach works. Therefore __weak is needed to ensure call is still > emitted. With GCC __attribute__((noipa)) might have been more appropritate, but > LLVM doesn't support it, so __weak is the next best thing supported by both with > the same side effect. Ah, okay, so it's to prevent compiler from optimizing away call to a noop function by telling it that we don't know what the function might eventually be. Thanks for the explanation. Yosry, can you please add a comment explaining what's going on? Thanks. -- tejun