From patchwork Thu Jan 18 20:13:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13522775 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 8483AC4707B for ; Thu, 18 Jan 2024 12:15:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1ABB86B009B; Thu, 18 Jan 2024 07:15:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 15BEA6B009D; Thu, 18 Jan 2024 07:15:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04A506B009E; Thu, 18 Jan 2024 07:15:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E9A176B009B for ; Thu, 18 Jan 2024 07:15:49 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id ABD99C0BD8 for ; Thu, 18 Jan 2024 12:15:49 +0000 (UTC) X-FDA: 81692328018.22.6C98122 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by imf25.hostedemail.com (Postfix) with ESMTP id F18F4A000C for ; Thu, 18 Jan 2024 12:15:40 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705580148; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=Vn7OfY49dLtW3Ecb6Gz6HGNmHjq9bxFZnpAYBEJ1P1k=; b=yXq5LkQC0Z3PAGJX+PRUZ0JYCaEbjoWGINxz4JV5G/h5e5FcvFtOYeh6i6svqjjoyRnmTs p5OorIzonW5DLPZ5QxnQIH9sknwJPcj7Gj0IIDrGNAyNTpdaHI1MliuhAgsiLo0Rc3354b h2uJKGqZZ1Sn39BnodxJRgEZ3ufo+l4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705580148; a=rsa-sha256; cv=none; b=jAxAQ0xWu9YE68Yh8MgQaarvnfBz0UjEQGxpxj55D0fpwWdn2pEfmcoJj5sowD9SNOTOpy UEKZigjqwuNLBBS3toVbW99sJa0a1rLxGwcWMXjGUJNiAluuJr/2QFfzUYA2BViammIktw mlM50sshGIeqAm8EYpMceAa14LWwLYI= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of shikemeng@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4TG1sv1m31z4f3jHZ for ; Thu, 18 Jan 2024 20:15:31 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.75]) by mail.maildlp.com (Postfix) with ESMTP id 05CC41A0272 for ; Thu, 18 Jan 2024 20:15:35 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgAnSQxlFqllWvbnBA--.43072S2; Thu, 18 Jan 2024 20:15:34 +0800 (CST) From: Kemeng Shi To: akpm@linux-foundation.org, jack@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] flex_proportions: remove unused fprop_local_single Date: Fri, 19 Jan 2024 04:13:21 +0800 Message-Id: <20240118201321.759174-1-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-CM-TRANSID: Syh0CgAnSQxlFqllWvbnBA--.43072S2 X-Coremail-Antispam: 1UD129KBjvJXoWxGF47CryrKFyUXry7ArWUJwb_yoWrGFy7pF nxK3yYgr4xZa18Ww4kA3ySywn7t348Jr18Ja47Cw4kCwsFyw1vqas7KF4rZa4Yk34rZrnY gFn8KFn8WFZ8AF7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_ Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26r xl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv 0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z2 80aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28I cxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2 IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI 42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42 IY6xAIw20EY4v20xvaj40_WFyUJVCq3wCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E 87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j-6pPUUUUU= X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-Rspamd-Queue-Id: F18F4A000C X-Rspam-User: X-Stat-Signature: d44oi5birjgzhwcebpce7pgh1gn3tmn7 X-Rspamd-Server: rspam03 X-HE-Tag: 1705580140-555629 X-HE-Meta: U2FsdGVkX18p7XPEBMAxw1hLpdQzM2PcyvRLbGDjHZ6pnMh+EYg+Si1QzbzEeC9flBHHPNskyN30nTLOj/h8KfafWOjOZNMwzhJXGxYZvOwyBmbhZkviPdARUWazVeVmoWXIfTqN/apoEpwVFo/19DKwR0jtQn3bzNTMfylAHoPjjJvMepJvbURS8Bl4vFqPx+j8dDoUyEaSsoFU2odeWT0ukAv3J+d1MFs9f73zazwJkg1ighGf0gnqjaIfT1LebusK8rUGGs8EbcOxZ6csb7JUtvq5d+Vazk8f9ChBhO4MyyfrO+FS7HO2qpj2aBDru/ct6iywRT99NmN2m/t6fop6wjfQc0uWp/fZD6oVnLucClyjK+SKHD16d5h4gFJPgueSYDjz3qWztTOQR80oe9Z7lfoDCglgXmAwLYzK5zsD2nmTtOtrLzyEnLcv7lyDQUuP/hDf36SufKJYok8NaqP3tStyKk5MyHgkzOEKISZCDPHBdp/+XPV4sFekGXEpGLlEp6+yE1D6h1Vk7o+FMN0SaEMsKWkZV7cagoZ85YqNJ7S1VFFTt/CiY1/QjGnvv2HvRzJp9aBS+BjJ0F0UY4h4AwMwmWxoDiLOecfNC5xthGResix7RmQlVOcU6U5kL8rq8TGP/UO2rZlzJmhKWgiY92bCu1s02niYPCrjz7kmncJomDdpVeceOyTiYLRa/a+INVVKPgafQbLsgTvoCPi+XFRwa5D7Cji0Hz+Odwz9v4fP5/Vi4SlANRKER/UVR4DIuo7J0Q0xIzvQqpIyipFAz3Ca2UB/ryP9vHcN/fxUii/+n3JTzJVRXYUBqp2OdjqkjZgaPobOW5qTc7qm9mVM2vosc4lxp7ftYagSboyK9HwY14aOQdXobcm2rHiP3iVRi+QmF1wnwI6yg9n8FczeG8v7rPSgRaWKgSp6cNjv5WqogR1UiWDT9mejrpEGo01+WHhOTguI21pu/CI zP9Vye8E 1fLgD4pwMduSpvcA5nVcYoI5mrlnXR+y1AJcc9NKqbkSV81ckQzieEtILRdRwy9cVF+CghPkDl5WeA5qWC2lkl0kqNpMJFSQRBnLEwKeoIqu6zfiL+BrrZDkO9ShdF7KUhV4UpIkcvOvcdPaupEjwuyfkzGXX5pa+15b8ZnCGQDlMAxrp6SIQdXByk78xjSHKkTVgN3J5GUxp445Etlm2ycWwVpKJYe3bW3QhAY+tjEm19V3/Sa6lCThCy3xnOmHtyOnf2uvYa7h1lb78rt84+BArTaoKcF0pBzvozwsDDO5f6nE= 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: List-Subscribe: List-Unsubscribe: The single variant of flex_proportions is not used. Simply remove it. Signed-off-by: Kemeng Shi Reviewed-by: Jan Kara --- include/linux/flex_proportions.h | 32 ------------- lib/flex_proportions.c | 77 -------------------------------- 2 files changed, 109 deletions(-) diff --git a/include/linux/flex_proportions.h b/include/linux/flex_proportions.h index 3e378b1fb0bc..e9a72fd0bfe7 100644 --- a/include/linux/flex_proportions.h +++ b/include/linux/flex_proportions.h @@ -38,38 +38,6 @@ int fprop_global_init(struct fprop_global *p, gfp_t gfp); void fprop_global_destroy(struct fprop_global *p); bool fprop_new_period(struct fprop_global *p, int periods); -/* - * ---- SINGLE ---- - */ -struct fprop_local_single { - /* the local events counter */ - unsigned long events; - /* Period in which we last updated events */ - unsigned int period; - raw_spinlock_t lock; /* Protect period and numerator */ -}; - -#define INIT_FPROP_LOCAL_SINGLE(name) \ -{ .lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \ -} - -int fprop_local_init_single(struct fprop_local_single *pl); -void fprop_local_destroy_single(struct fprop_local_single *pl); -void __fprop_inc_single(struct fprop_global *p, struct fprop_local_single *pl); -void fprop_fraction_single(struct fprop_global *p, - struct fprop_local_single *pl, unsigned long *numerator, - unsigned long *denominator); - -static inline -void fprop_inc_single(struct fprop_global *p, struct fprop_local_single *pl) -{ - unsigned long flags; - - local_irq_save(flags); - __fprop_inc_single(p, pl); - local_irq_restore(flags); -} - /* * ---- PERCPU ---- */ diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index 83332fefa6f4..84ecccddc771 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c @@ -83,83 +83,6 @@ bool fprop_new_period(struct fprop_global *p, int periods) return true; } -/* - * ---- SINGLE ---- - */ - -int fprop_local_init_single(struct fprop_local_single *pl) -{ - pl->events = 0; - pl->period = 0; - raw_spin_lock_init(&pl->lock); - return 0; -} - -void fprop_local_destroy_single(struct fprop_local_single *pl) -{ -} - -static void fprop_reflect_period_single(struct fprop_global *p, - struct fprop_local_single *pl) -{ - unsigned int period = p->period; - unsigned long flags; - - /* Fast path - period didn't change */ - if (pl->period == period) - return; - raw_spin_lock_irqsave(&pl->lock, flags); - /* Someone updated pl->period while we were spinning? */ - if (pl->period >= period) { - raw_spin_unlock_irqrestore(&pl->lock, flags); - return; - } - /* Aging zeroed our fraction? */ - if (period - pl->period < BITS_PER_LONG) - pl->events >>= period - pl->period; - else - pl->events = 0; - pl->period = period; - raw_spin_unlock_irqrestore(&pl->lock, flags); -} - -/* Event of type pl happened */ -void __fprop_inc_single(struct fprop_global *p, struct fprop_local_single *pl) -{ - fprop_reflect_period_single(p, pl); - pl->events++; - percpu_counter_add(&p->events, 1); -} - -/* Return fraction of events of type pl */ -void fprop_fraction_single(struct fprop_global *p, - struct fprop_local_single *pl, - unsigned long *numerator, unsigned long *denominator) -{ - unsigned int seq; - s64 num, den; - - do { - seq = read_seqcount_begin(&p->sequence); - fprop_reflect_period_single(p, pl); - num = pl->events; - den = percpu_counter_read_positive(&p->events); - } while (read_seqcount_retry(&p->sequence, seq)); - - /* - * Make fraction <= 1 and denominator > 0 even in presence of percpu - * counter errors - */ - if (den <= num) { - if (num) - den = num; - else - den = 1; - } - *denominator = den; - *numerator = num; -} - /* * ---- PERCPU ---- */