Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp815168ybk; Wed, 13 May 2020 13:57:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLRtoypoi95Uh7GlVqCA4zI9YxdAqWFlUdF94ZCadN92MkdfyMH2OM0z0k6hPRMeIIQxCw X-Received: by 2002:aa7:d783:: with SMTP id s3mr1450801edq.64.1589403432455; Wed, 13 May 2020 13:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589403432; cv=none; d=google.com; s=arc-20160816; b=Nckl48AoF1cjOuUyZ533dMqiL9gMfSh7gJAul+gfwGcy1nkd/ewrJaB0hvK4cA4XjE PJBXQVfTiC86eNpR4iqwqcuPfZyyxP/Cza1eTaYzOmiI2E3vnIDw8LTGbHD+BglPsvLA S5dGVnORKbe0UCrmSVRXTzoNYILPlbFtfaCxxVCqb0gN1SXX16KYoxtYIgxjrF4h8n6T tNpE8TIkfjFDfNfx3Wr/QvqRuySepM2wWUB5ausThHsi2gKpcmCbNbTFzoTldnIhVkby RRMA8p0UP6yRk1Pwb6AfYVKthxAvgJTNkEL9asPA2Q7wffWmM0PhiD57C0mEHNSL3QWD X2wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=soxLFGcusBrU6Ui7EMNphc3/4GGGrCTLXGXwJr1QcwI=; b=aMJbF8dbaljqmfvtK5W3ZO3Pz1uN/ELEgSoHc+nyGVoz5r1l6fBpxM4kn3slZgd2Bx /MorC3SW94sFyYKRzs0Jrq592JsiR48VNcNuESUEspFeSJf/6Kqe4g6pfy6oA36I3YTK b8qntye/LRvN/nJ9asHaBdjXDfGoivOWtlpDU26tLujETEYuD5DuCf8khYKzFShGfHyH 8NTBt0p//pIhcRLrsbYEVgQnmKgvjXMykTsAwS66TLR8omt3jG6nopjlSV5aQBEUvlQJ pTX1GghqeFcqmLsOatlbbP+MX0GPSKk7LoeaejKMQGa6/Opzd357eqE9UGpc2trYvFNd FdFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=iogvTZzs; 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 l18si520693ejb.405.2020.05.13.13.56.49; Wed, 13 May 2020 13:57:12 -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; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=iogvTZzs; 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 S1726885AbgEMUzg (ORCPT + 99 others); Wed, 13 May 2020 16:55:36 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:58917 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726015AbgEMUzf (ORCPT ); Wed, 13 May 2020 16:55:35 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589403335; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=soxLFGcusBrU6Ui7EMNphc3/4GGGrCTLXGXwJr1QcwI=; b=iogvTZzsoBVQ8yomeTZeL0ShzP3qsArRja8egCiQR2vEj/uVeFpV2do1KJlfOy41L2SqBlk6 KcjjZflp0+xk4SD6GkDZt/3ecFHCIxk6BwHuWLqoPqe4LkbFFCzp8eNZB79yLauDRK4e5lge IPKOYN4B1xJMQicYI47UAbQ5kIA= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ebc5ec5.7f453b5d4298-smtp-out-n05; Wed, 13 May 2020 20:55:33 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8F963C43636; Wed, 13 May 2020 20:55:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: psodagud) by smtp.codeaurora.org (Postfix) with ESMTPSA id F0E27C433F2; Wed, 13 May 2020 20:55:31 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 13 May 2020 13:55:31 -0700 From: psodagud@codeaurora.org To: Thomas Gleixner 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: <87d0771swr.fsf@nanos.tec.linutronix.de> 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> <87d0771swr.fsf@nanos.tec.linutronix.de> Message-ID: X-Sender: psodagud@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-05-13 13:28, Thomas Gleixner wrote: > 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: Thanks Tglx for quick response. I think, you are referring stub functions. Yes. I can reduce some of the #ifdefs with stub functions as you mentioned and not all the cases right? I have introduced two variables timer_base_deferrable and deferrable_pending and I can put stub function where ever is possible. But it may not be appropriate to have stub function for all the references of these variables right? Correct me if my understanding is wrong. -Thanks, Prasad > >>> Stub functions exist to avoid this unreadable #ifdef garbage.