Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp815644ybk; Wed, 13 May 2020 13:58:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7U/LqzKxBHwcOwrpQ+vQDOmsEy1rYJVZaS2bgtbjRsiAqZVh9qKQGs/8Lhe3HLvYR8Dk2 X-Received: by 2002:a50:9dcd:: with SMTP id l13mr1442016edk.126.1589403495178; Wed, 13 May 2020 13:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589403495; cv=none; d=google.com; s=arc-20160816; b=t3h9ID4jDbRCH5j6xn2kV/El+FfPPhutmsvSQIv0B4PXblobtrPmuqXJ+5WekwMmAa r93FI1A6q1inMooTETkzSlm24VIIB+uBA761FuozvIGXjiegzCbGJrcLiQlVESrUQTH/ kJ6I1dKUMbikAZ5X+LMQvG3wIrO1sLqQQH6JdeTyLs+zIoFdfmw82SvwTHXsh4d7sXqJ 28avJnMYqPgBq+ku7riXfCGCIug4tscLsL1AehvsjrtWg15ITLeOaB8DLykCgFfECpSb Onsw2ebnzNsmR4m+v58cvEJFraFgYik5mV4UDXarL/rAJ2yquDn2Y3byfr6FZd0aqnt1 JoOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=cVr8GIryukTCclFwh2rlV/fpdG5SuP5Vsr8fPcvqEhA=; b=quW53WSKuUvbbSywt2Jf3bB4X5VANRE7EnlDICkoouKRuWS+1rulG+8BEzYxLe+tNE ir6HBj4bGtBRWWAF8M/07K2hBuzuTJ1X3STCrIuRxEdTY0UllQY2ZoGbNhNU6BjftrQU RozXfl//YfBBpwesC0UHMsMKqzYnTD/fQ45Gyot8mMK1ISIM4ONnwiRe2WlcsaxaimPP 1/ySPo3W4STRiZkWhkkv5C7trtArhNTw6Y4rQ8cJXqWK0zMglt4CX+zphA3zklrAIp78 /PcsYmJLSKUVbP/Mf65t3ts0lpSX+WliKAc2Dl8w99fJSlnkNdcs5Oxgo/cb8oKUJ2e7 jxOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n19si535585ejc.415.2020.05.13.13.57.52; Wed, 13 May 2020 13:58:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726051AbgEMU20 (ORCPT + 99 others); Wed, 13 May 2020 16:28:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725977AbgEMU20 (ORCPT ); Wed, 13 May 2020 16:28:26 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 476D2C061A0C for ; Wed, 13 May 2020 13:28:26 -0700 (PDT) Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jYxzJ-0003vJ-1H; Wed, 13 May 2020 22:28:21 +0200 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 2E545100605; Wed, 13 May 2020 22:28:20 +0200 (CEST) From: Thomas Gleixner To: psodagud@codeaurora.org Cc: john.stultz@linaro.org, sboyd@kernel.org, tj@kernel.org, linux-kernel@vger.kernel.org, saravanak@google.com, pkondeti@codeaurora.org, Joonwoo Park Subject: Re: [PATCH v3 1/2] timer: make deferrable cpu unbound timers really not bound to a cpu In-Reply-To: References: <1588444137-18651-1-git-send-email-psodagud@codeaurora.org> <1588444137-18651-2-git-send-email-psodagud@codeaurora.org> <87a72lkx9t.fsf@nanos.tec.linutronix.de> Date: Wed, 13 May 2020 22:28:20 +0200 Message-ID: <87d0771swr.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org psodagud@codeaurora.org writes: > On 2020-05-06 06:28, Thomas Gleixner wrote: >>> #ifdef CONFIG_SMP >>> +struct timer_base timer_base_deferrable; >>> unsigned int sysctl_timer_migration = 1; >>> >>> DEFINE_STATIC_KEY_FALSE(timers_migration_enabled); >>> @@ -841,8 +842,14 @@ static inline struct timer_base >>> *get_timer_cpu_base(u32 tflags, u32 cpu) >>> * If the timer is deferrable and NO_HZ_COMMON is set then we need >>> * to use the deferrable base. >>> */ >>> - if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && (tflags & TIMER_DEFERRABLE)) >>> - base = per_cpu_ptr(&timer_bases[BASE_DEF], cpu); >>> + if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && (tflags & TIMER_DEFERRABLE)) >>> { >>> +#ifdef CONFIG_SMP >>> + base = &timer_base_deferrable; >>> +#endif >> >> There are definitely smarter ways of solving this than sprinkling >> #ifdef's around the code. > > I am able to understand all other comments and I will address all those > comments in the next patch set. > It is not clear to me how to avoid #ifdef's in this case. Could you > please share an example here? The answer is further down already: >> Stub functions exist to avoid this unreadable #ifdef garbage.