Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp162192pxa; Thu, 13 Aug 2020 23:50:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRpBXn2degH43+3+ZA8Ddz+na2Cugb2qCoq509Z8W26Ij0+DdaVQE+Z0Cuk+VrEAjSJkV2 X-Received: by 2002:a50:f288:: with SMTP id f8mr900440edm.247.1597387818822; Thu, 13 Aug 2020 23:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597387818; cv=none; d=google.com; s=arc-20160816; b=05l8IH7WZjZSYzHiRHzwx/+L6jN1GG5HQblVQCVuHxeWL765be68VfMqD3meympsxd scPOgrC5UP+AA/CzTTK1ki/zpVVqvtwo7oyKDesoidfNofDIdRCmJxHmTN3Ie/SZtWqF EmgSZOTBVvahiPjEegl1mwQFIlqAXYLENn/gpKy6hj3uv3DC3PqAeujHpFCvxxXvn0RQ X6u+5MFuiGcVWplZc78hcjv7BRCoRIAWZtE3Ep+Pk12ALJjwQJ7KDziP6tbA3c557cNq MwQkDgwMr4Q9lRUJ7DoWjWZNpN919A93CpyJoCJVcVc7AZNFn8lvW+BZsiW/oBwtOWwt EAyQ== 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:subject:cc :to:from; bh=T1QWZbT499mDJWKZBQj1CbIwHP3x1IxMpZqQOUfeycc=; b=c7Bd7HyqH3cqzOQrxB7HzGR7tAosTq43XjvCAOiwanoOslm+Pvxgs2ZDlrjxMR6SgO VLloKkhWaymjy8kd95eINEm2YhblHlFE82a30qEA1gsi2XkfRzM/finVrLzBBpICAU0V HmxSR5TWR7rUJZUOJ2uKQyvHPYcK95+DrxmJcMCDUA8RWB2kPPzlv6D+oQqhOUXu9kLW 5U4nKekrFgLnrzzBY59RTz60vIf3/sVCQRLz/EF/H74Q2sdhYW7DkvhDcJUZ6ET5JUvM /WaZOt/c7pRBwisNqbooxYQavhXRNSe4Br3lmD0uGPlqTEOI4RA1R77UNyHG/akAqL1N PqhQ== 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 dn14si4783640edb.558.2020.08.13.23.49.52; Thu, 13 Aug 2020 23:50:18 -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 S1726193AbgHNGq7 (ORCPT + 99 others); Fri, 14 Aug 2020 02:46:59 -0400 Received: from mail.windriver.com ([147.11.1.11]:36062 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbgHNGq6 (ORCPT ); Fri, 14 Aug 2020 02:46:58 -0400 Received: from ALA-HCB.corp.ad.wrs.com (ala-hcb.corp.ad.wrs.com [147.11.189.41]) by mail.windriver.com (8.15.2/8.15.2) with ESMTPS id 07E6kCBH029450 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 13 Aug 2020 23:46:13 -0700 (PDT) Received: from pek-qzhang2-d1.wrs.com (128.224.162.183) by ALA-HCB.corp.ad.wrs.com (147.11.189.41) with Microsoft SMTP Server id 14.3.487.0; Thu, 13 Aug 2020 23:45:59 -0700 From: To: , , , , , CC: , Subject: [PATCH] rcu: shrink each possible cpu krcp Date: Fri, 14 Aug 2020 14:45:57 +0800 Message-ID: <20200814064557.17365-1-qiang.zhang@windriver.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zqiang Due to cpu hotplug. some cpu may be offline after call "kfree_call_rcu" func, if the shrinker is triggered at this time, we should drain each possible cpu "krcp". Signed-off-by: Zqiang --- kernel/rcu/tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 8ce77d9ac716..619ccbb3fe4b 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3443,7 +3443,7 @@ kfree_rcu_shrink_count(struct shrinker *shrink, struct shrink_control *sc) unsigned long count = 0; /* Snapshot count of all CPUs */ - for_each_online_cpu(cpu) { + for_each_possible_cpu(cpu) { struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu); count += READ_ONCE(krcp->count); @@ -3458,7 +3458,7 @@ kfree_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) int cpu, freed = 0; unsigned long flags; - for_each_online_cpu(cpu) { + for_each_possible_cpu(cpu) { int count; struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu); @@ -3491,7 +3491,7 @@ void __init kfree_rcu_scheduler_running(void) int cpu; unsigned long flags; - for_each_online_cpu(cpu) { + for_each_possible_cpu(cpu) { struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu); raw_spin_lock_irqsave(&krcp->lock, flags); -- 2.17.1