Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp466063iol; Thu, 9 Jun 2022 07:21:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxurZ+2o3f04Scsvekkk7nkDZ3YK9e0kM2l39vutoyVso5/UihPSMMaszhH4mWxN1FT1Gls X-Received: by 2002:a65:558d:0:b0:3f5:f26d:f420 with SMTP id j13-20020a65558d000000b003f5f26df420mr34935498pgs.434.1654784481529; Thu, 09 Jun 2022 07:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654784481; cv=none; d=google.com; s=arc-20160816; b=k73Da8FGm7JNNTXfP78cLTDCylgLfIZJW89Pji21IPSIIMzB6VaqSxZ3/EJLNXCCVB rHeQS3aNadT4VKWnUkP3Rl0LuCcSsCqRbVCWz19NlwJ5jIBD6QskIwWwsY1tJI8+kduT OBd306yPUk6AAsTO104fej6tWuRYlez96JQUUUz5UdRV9X5+C7jWqOWBH2RpwdXBI+4D v0bYPHAEFP8aaFc4nbbOTkKbBQgTfgGFNPrLoTeGmNuD183xtq9wdAuSiP5scNqRuhXh rMMwts7f+4Qt7gj1t4xK7rq/GT4Co0H8sCQXhPdYp8LLgUTcbExqCchTj5jcdgAGKxpF sbVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=jqhwYhya53Ub6ysqItH4y8unqJO0QhApIrC1/649j54=; b=N2w91rTdXEDbkQAITNwXG1yOil/Gb6qIMkoc8MEv0c3/rLpMmP/75EB+yaJ1jyuVIq weWR8dybh8boaFWtAuoE9tBnwGYoymoiuKHmMT+5yG7dAyTpVx35P20Ge/6x1xD2SyPM Xbn31PaeJdykht7UvfKZ+EN0Xpc8dWaQZX4CXCdyh1TYIO/NEjsLMbxtqPwLmlhRvnyh KmuTuXZIuujAWhYIckM7x1Aj96GCvQvyL2Z1UL5KlnbcVjdrOprqI2L31st8YiJoTCcW SiryvRAisWcZR8WibNuFZzRxozLvML6V80/JswqknkPuywE9T3d0N3jGP9VG7+sUJNtc o3Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fGOxnn0A; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a5-20020a170902ecc500b00162380ace44si25283118plh.463.2022.06.09.07.21.06; Thu, 09 Jun 2022 07:21:21 -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=@google.com header.s=20210112 header.b=fGOxnn0A; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236850AbiFIOBA (ORCPT + 99 others); Thu, 9 Jun 2022 10:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243902AbiFIOA4 (ORCPT ); Thu, 9 Jun 2022 10:00:56 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DB0F17B852 for ; Thu, 9 Jun 2022 07:00:55 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id r1so13330370ybd.4 for ; Thu, 09 Jun 2022 07:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jqhwYhya53Ub6ysqItH4y8unqJO0QhApIrC1/649j54=; b=fGOxnn0AqIvYwnlMzEqVt2e8++kIdmsh79Hl2DvxieLeED7eK+Cc6fsvF3UcIM7nvV U6qYnDICRLaiJkcwGKsasTPP4dcUwp7ITGHcGUdzJbJ8XAdlN+CfDvbYsEEYdhNCguKp qrmjHuQfrNYXGZI7AQQUGhB5jI3Ohh6mOo6mNsG6wFsuSMNQsColJNkAh9OU2W0FTQu9 97lskwpM1QSWrTR6eivnxWbhCLpJWZiObbiCq9FVCyouTtaF/acGBdX0fS3Vud/WQuAj W7TsxsE+YptpX2ec1uuqVrpEk7dxtnqbEDCuGXPJTv/VSfFSwn5pcF4M2++C0viTCSTA xSWw== 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; bh=jqhwYhya53Ub6ysqItH4y8unqJO0QhApIrC1/649j54=; b=ZBmyWFkPpSx5EmYr7ppSNUHTRvkl37yd47wwwohycSfFmZvhOuac2XlhJMSQgPbQ9y gzt9BTE7SGckDDQ0LabPXn9iNJGrJZ42JdMqqLAeD1h0V4FPmDLKOlm4/XT6dqklLYr9 Q2JOTOe0QV0QiMSTlGDZErufd9ApIW0ZkYtF8gtpVQ32CgIhRPEoWH6PwSEmQ977iddE daM8oL41SAr8XTIlN6elKuO/ZSVHKWsF4RFVCUWik0zi0f4VpdMhwzQBigeVcyYrxuTU r0ZSp953LVN1G1Pmqy70jwSuVfTcoPcy8Ed926NqizPEFS2Ckp3PeDB2npdXbDeHN7Fd TcSQ== X-Gm-Message-State: AOAM533/hHDihcIcCC3PXeIKXdS4MQo9kYA2fgfNT3/wD91GGarGdaik GZG+HMaXScxna8wcOXSF8u5L3In250Iux2uNtVOlRA== X-Received: by 2002:a25:780b:0:b0:664:3e22:3368 with SMTP id t11-20020a25780b000000b006643e223368mr2020008ybc.625.1654783254347; Thu, 09 Jun 2022 07:00:54 -0700 (PDT) MIME-Version: 1.0 References: <20220609113046.780504-1-elver@google.com> <20220609113046.780504-6-elver@google.com> In-Reply-To: From: Marco Elver Date: Thu, 9 Jun 2022 16:00:16 +0200 Message-ID: Subject: Re: [PATCH 5/8] perf/hw_breakpoint: Remove useless code related to flexible breakpoints To: Dmitry Vyukov Cc: Peter Zijlstra , Frederic Weisbecker , Ingo Molnar , Thomas Gleixner , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, x86@kernel.org, linux-sh@vger.kernel.org, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Thu, 9 Jun 2022 at 15:41, Dmitry Vyukov wrote: > > On Thu, 9 Jun 2022 at 14:04, Dmitry Vyukov wrote: > > > > On Thu, 9 Jun 2022 at 13:31, Marco Elver wrote: > > > > > > Flexible breakpoints have never been implemented, with > > > bp_cpuinfo::flexible always being 0. Unfortunately, they still occupy 4 > > > bytes in each bp_cpuinfo and bp_busy_slots, as well as computing the max > > > flexible count in fetch_bp_busy_slots(). > > > > > > This again causes suboptimal code generation, when we always know that > > > `!!slots.flexible` will be 0. > > > > > > Just get rid of the flexible "placeholder" and remove all real code > > > related to it. Make a note in the comment related to the constraints > > > algorithm but don't remove them from the algorithm, so that if in future > > > flexible breakpoints need supporting, it should be trivial to revive > > > them (along with reverting this change). > > > > > > Signed-off-by: Marco Elver > > > > Was added in 2009. > > > > Acked-by: Dmitry Vyukov > > > > > --- > > > kernel/events/hw_breakpoint.c | 12 +++--------- > > > 1 file changed, 3 insertions(+), 9 deletions(-) > > > > > > diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c > > > index 5f40c8dfa042..afe0a6007e96 100644 > > > --- a/kernel/events/hw_breakpoint.c > > > +++ b/kernel/events/hw_breakpoint.c > > > @@ -46,8 +46,6 @@ struct bp_cpuinfo { > > > #else > > > unsigned int *tsk_pinned; > > > #endif > > > - /* Number of non-pinned cpu/task breakpoints in a cpu */ > > > - unsigned int flexible; /* XXX: placeholder, see fetch_this_slot() */ > > > }; > > > > > > static DEFINE_PER_CPU(struct bp_cpuinfo, bp_cpuinfo[TYPE_MAX]); > > > @@ -71,7 +69,6 @@ static bool constraints_initialized __ro_after_init; > > > /* Gather the number of total pinned and un-pinned bp in a cpuset */ > > > struct bp_busy_slots { > > Do we also want to remove this struct altogether? Now it becomes just > an int counter. Yes, that actually can simplify a bunch of things, including fetch_bp_busy_slots() just returning an int and fetch_this_slot() can be removed (it'll be even cleaner if we remove the overridable weight). I'll simplify unless I hear objections.