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 6528BC433FE for ; Wed, 9 Nov 2022 01:27:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4E6E6B0071; Tue, 8 Nov 2022 20:27:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DFEC18E0002; Tue, 8 Nov 2022 20:27:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CED1B6B0073; Tue, 8 Nov 2022 20:27:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BCA376B0071 for ; Tue, 8 Nov 2022 20:27:09 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8238740380 for ; Wed, 9 Nov 2022 01:27:09 +0000 (UTC) X-FDA: 80112165378.06.913DAEC Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 2B71D1A000F for ; Wed, 9 Nov 2022 01:27:03 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2CA4C617D1; Wed, 9 Nov 2022 01:26:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 749A6C433D6; Wed, 9 Nov 2022 01:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1667957164; bh=ZdA9nnjgiqkULm/2CYWReaWHEj0W9yQeyo+RMreYUGU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kiq6sejn72sdBNPL85xF6fLLHn94q0lxy4k59EKKTZt43x+t3BTnWnwdGM2kaebmX FfGslhJ8eso5egIgPk2/qhjlQtwpLeKFkRMajd61GsEZeWqXNx4ytKDIWKPNhEwEQ3 h5+w7PW7QwZ0NZy+v8SZK4dM0HGZq/gXWGZjcnHM= Date: Tue, 8 Nov 2022 17:26:03 -0800 From: Andrew Morton To: Shakeel Butt Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Marek Szyprowski Subject: Re: [PATCH v2] percpu_counter: add percpu_counter_sum_all interface Message-Id: <20221108172603.8d547faa8f0cf0c340fd7150@linux-foundation.org> In-Reply-To: <20221109012011.881058-1-shakeelb@google.com> References: <20221109012011.881058-1-shakeelb@google.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667957224; a=rsa-sha256; cv=none; b=02o44yWNpXu/Ez8T2gzwJcZAs6VLCfIitAHiFo53eJ+rveP0M1Uw75OMGLnjogeyy5qY/u 7ZicDHc7yPAxyRW2UWUZuvvXDtB4FWzym+Yx/SyCWO/jRZAtAIGMApUOAjE4uosdOH2xMp qsWL/IirH63N6VHlTrN06qnSZTtnOVA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=kiq6sejn; spf=pass (imf19.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667957224; 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=7cCd6kpBbZzWW2p1qrrglqfTdDe5GzsMWNm93wo1Nrs=; b=nCP0fx3IE0+CoJB+2/ccz8JikG9uqgVVVUcOoszYMEoCp3ySOaERFhVWfbYnauoY3t53zf lLRSRdD8KNp86ymJCTjIDU3s2zLZc+6BraFZ9OIjihcXdqivl2w/IhOpnVlqnm5WoYrkLb 6SrRx+ppXQkW5iJvc5xyQh2az06da0E= Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=kiq6sejn; spf=pass (imf19.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam12 X-Rspam-User: X-Stat-Signature: u7eoci7ysg73ro6kwayy6sbecmzjyqib X-Rspamd-Queue-Id: 2B71D1A000F X-HE-Tag: 1667957223-500091 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 Wed, 9 Nov 2022 01:20:11 +0000 Shakeel Butt wrote: > However there is a small race window between the online CPUs traversal > of percpu_counter_sum and the CPU offline callback. The offline callback > has to traverse all the percpu_counters on the system to flush the CPU > local data which can be a lot. During that time, the CPU which is going > offline has already been published as offline to all the readers. So, as > the offline callback is running, percpu_counter_sum can be called for > one counter which has some state on the CPU going offline. Since > percpu_counter_sum only traverses online CPUs, it will skip that > specific CPU and the offline callback might not have flushed the state > for that specific percpu_counter on that offlined CPU. LGTM. What are the user-visible effects of this bug? Should we cc:stable? If so, can you identify a suitable Fixes:? Thanks.