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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 525ACC19F2D for ; Tue, 9 Aug 2022 12:29:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AD058E0001; Tue, 9 Aug 2022 08:29:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7353A6B0072; Tue, 9 Aug 2022 08:29:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 587CC8E0001; Tue, 9 Aug 2022 08:29:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 442596B0071 for ; Tue, 9 Aug 2022 08:29:26 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0D00AC02AF for ; Tue, 9 Aug 2022 12:29:26 +0000 (UTC) X-FDA: 79779984732.04.94C7FC0 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by imf31.hostedemail.com (Postfix) with ESMTP id 8808220169 for ; Tue, 9 Aug 2022 12:29:24 +0000 (UTC) Received: by mail-lj1-f171.google.com with SMTP id y23so12781195ljh.12 for ; Tue, 09 Aug 2022 05:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=3+KBkpV9m1bxJhsMtzeVGV+drTP66AAmd/wpftn5OL4=; b=E6FupvpTXxk3V7KyG/UrXwV0+9ePJHgQQbeBBwxS0LtgXCHuLfAblq2be3zPHNhFB/ vU1EKkk3gRW0HTgiBX5BfrJuD1WggYV2YPN8v3MuvYDa3wYj8nRV2W4n1joyK0aa1b+4 l8DJQzOPlXgjSBkJWS4VIsnVC0XlC5ryT1cJo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=3+KBkpV9m1bxJhsMtzeVGV+drTP66AAmd/wpftn5OL4=; b=uxidCtd2ATBIdim0rp2gFxEga7TQKWev4UzUX3/BnGvv9NP1y+vxTA5OYOJzYdpfoR SRP/W0hN8jS4WS7guccY9xnCycgHCwJyXJScfRl4CASpbJRs0QX81cTdALZaOByzjF6+ 1DAr/cLysQvT4P7Eos68TWqKFWtp3f0FGdT4j6KX8yvllVhrpU6xwDooyxpr5SbMxk60 1oHLrHdyclQwmPl3uqhZtGKWZUrVWk3cOoP+HBTM/rEv8nfJC2jpT7KBP2vdthgwkkjS 4dkzjYhw677BFATx6r9aQRa7DpldHXWaRDg/U/pkA3qiVvl1r5KgVAqP8c9Gre8KeQNP p/nw== X-Gm-Message-State: ACgBeo1cRM7ikO1RYhtmXI7dmwfjL09BYCq1V1y2T/oFYWiz8Ay2vZKN QwTNvqECmM1iv5d5gtchXcYwAg== X-Google-Smtp-Source: AA6agR7f9t6NUk6GIPJFQim/LeGnjxzz1Ffi5AyCR+zSh+hscpnQ+tPNX0g+xvGZG32bZsniYdwOeQ== X-Received: by 2002:a2e:8008:0:b0:25f:dd78:8312 with SMTP id j8-20020a2e8008000000b0025fdd788312mr3002868ljg.127.1660048162776; Tue, 09 Aug 2022 05:29:22 -0700 (PDT) Received: from [172.16.11.74] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id y8-20020ac24208000000b0047f8e9826a1sm1752461lfh.31.2022.08.09.05.29.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Aug 2022 05:29:19 -0700 (PDT) Message-ID: <79b1b62c-8ea1-5f47-bf80-3e003f7a3ac7@rasmusvillemoes.dk> Date: Tue, 9 Aug 2022 14:29:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 11/16] time: optimize tick_check_preferred() Content-Language: en-US To: Yury Norov , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Alexander Lobakin , Alexei Starovoitov , Alexey Klimov , Andrew Morton , Andrii Nakryiko , Andy Shevchenko , Ben Segall , Christoph Lameter , Dan Williams , Daniel Borkmann , Daniel Bristot de Oliveira , Dennis Zhou , Dietmar Eggemann , Eric Dumazet , Frederic Weisbecker , Guenter Roeck , Ingo Molnar , Isabella Basso , John Fastabend , Josh Poimboeuf , Juergen Gross , Juri Lelli , KP Singh , Kees Cook , Martin KaFai Lau , Mel Gorman , Miroslav Benes , Nathan Chancellor , "Paul E . McKenney" , Peter Zijlstra , Randy Dunlap , Sebastian Andrzej Siewior , Song Liu , Steven Rostedt , Tejun Heo , Valentin Schneider , Vincent Guittot , Vlastimil Babka , Yonghong Song , linux-mm@kvack.org, netdev@vger.kernel.org, bpf@vger.kernel.org References: <20220718192844.1805158-1-yury.norov@gmail.com> <20220718192844.1805158-12-yury.norov@gmail.com> <87fsi9rcxu.ffs@tglx> <87czdbq7up.ffs@tglx> From: Rasmus Villemoes In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660048164; a=rsa-sha256; cv=none; b=CpSUlczZhoJ7iW8pU5wp2hEFqAEEbRSNmybVhEILhOdEVl8xn3gdWCOYIbLtpOdW9oJ3My bQ7Y21l24j5x5+f4QD8YiG3bO+bpdlwzPIuhrvFHqrmXnPbg6Rl4CnyAea7DVCNyPH4Hui SRcsL+qNtf9U2UntVMW1VZmC8zES0nI= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=rasmusvillemoes.dk header.s=google header.b=E6FupvpT; dmarc=none; spf=pass (imf31.hostedemail.com: domain of linux@rasmusvillemoes.dk designates 209.85.208.171 as permitted sender) smtp.mailfrom=linux@rasmusvillemoes.dk ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660048164; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3+KBkpV9m1bxJhsMtzeVGV+drTP66AAmd/wpftn5OL4=; b=lYsE9OVtMfBMvf/9+lTZdeyERQgwd7mLR0BMQd2OCKlkYvsn0MENs50079FtzZFjv0u1Ea Pa4EbTyDdhGtVfk4qFaMjvJiDAFqtZYXdDnYnbL+jTFrYPIvBcvsGd+gE4+bqzxNcruwTC VwnQUZwdvmibJBaBbbnjuuiVKEhJ/bk= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 8808220169 Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=rasmusvillemoes.dk header.s=google header.b=E6FupvpT; dmarc=none; spf=pass (imf31.hostedemail.com: domain of linux@rasmusvillemoes.dk designates 209.85.208.171 as permitted sender) smtp.mailfrom=linux@rasmusvillemoes.dk X-Rspam-User: X-Stat-Signature: 46416ka4x97zjjm5333stgtn5xtecgtf X-HE-Tag: 1660048164-644480 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 08/08/2022 18.38, Yury Norov wrote: > On Mon, Aug 08, 2022 at 01:42:54PM +0200, Thomas Gleixner wrote: >> On Sat, Aug 06 2022 at 10:30, Thomas Gleixner wrote: >>> On Mon, Jul 18 2022 at 12:28, Yury Norov wrote: >>> >>>> tick_check_preferred() calls cpumask_equal() even if >>>> curdev->cpumask == newdev->cpumask. Fix it. >>> >>> What's to fix here? It's a pointless operation in a slow path and all >>> your "fix' is doing is to make the code larger. > > Pointless operation in a slow path is still pointless. > >> In fact cpumask_equal() should have the ptr1 == ptr2 check, so you don't >> have to add it all over the place. > > This adds to the image size: > add/remove: 1/1 grow/shrink: 24/3 up/down: 507/-46 (461) > > The more important, cpumask shouldn't check parameters because this is > an internal function. This whole series point is about adding such checks > under DEBUG_BITMAP config, and not affecting general case. Yury, calling bitmap_equal (and by extension cpumask_equal) with something that happens in some cases to be the same pointer for both operands is not a bug. If you want to optimize that case, add a check in __bitmap_equal(), it will add a few bytes (maybe 2-4 instructions) to the kernel image, much less than what this whole series does by open-coding that check all over, and since it's comparing two registers, it won't in any way affect the performance of the case where the pointers are distinct. Rasmus