Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29992C433DB for ; Fri, 12 Mar 2021 14:46:14 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D90D064FD6; Fri, 12 Mar 2021 14:46:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D90D064FD6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1lKj3M-0001JS-KW; Fri, 12 Mar 2021 14:46:12 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKj3L-0001JF-Je for linux-f2fs-devel@lists.sourceforge.net; Fri, 12 Mar 2021 14:46:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Mr1FjbtOo2oaErNudiDkdyq/FC3uXpVrOtNOsRZRzZU=; b=XGA9KioGFVcXX5jeh9HSRVvN0s +lCUKRUAzDe8l5bmkbQJF+sAv0kPYYEdYKVBhYEt16Fenmxrj1azATTrjyKqQtqYPeAG53KX6G6Pc 1Qeb274JSKqlLvh2PDuV2XvTxykkCLajdzVrNZ2XBOZeQlDHYt9HRMClA62y/ANaCab8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Mr1FjbtOo2oaErNudiDkdyq/FC3uXpVrOtNOsRZRzZU=; b=fYq1S80G3nxHTBepXwVYVEa0py Lss/xD6vo05jt9pD10SyLmjKz1nAFbAwZtfJ3yq8rh/We6mPCyxfUra9FCt1mvsPzLtJIgvlm9Bcs hUIZ5ckRnosncT/YQ8UJIN9cLv73Bd9wHmm436kFuLpqDqx8+fl6L17A66Ied7WAKTmM=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1lKj36-005syX-7W for linux-f2fs-devel@lists.sourceforge.net; Fri, 12 Mar 2021 14:46:11 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4536A64FD6; Fri, 12 Mar 2021 14:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615560350; bh=5OcUS67DMAnxCxpF2YhrDjA4ZH7gotBBF3aF5cp7VAo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OGrTW2c5kQMZqDLHOuPubJDXsH5iNNl9G1C8bABPxHyPcm06lamlCYPxjL/7xokSu 6xqdQEaz0tP0k8l4U3D3jCYKk3PxisKyYJ9L5pw2AdXmglGrmAxermQHLMydovsQSS IA2wUtJS7RrAgy28DpmknVJbOyZw2fAvOZcmmZbs= Date: Fri, 12 Mar 2021 15:45:48 +0100 From: Greg KH To: Daeho Jeong Message-ID: References: <20210312122531.2717093-1-daeho43@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1lKj36-005syX-7W Subject: Re: [f2fs-dev] [PATCH v4] f2fs: add sysfs nodes to get runtime compression stat X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daeho Jeong , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net A: http://en.wikipedia.org/wiki/Top_post Q: Were do I find info about this thing called top-posting? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? A: No. Q: Should I include quotations after my reply? http://daringfireball.net/2007/07/on_top On Fri, Mar 12, 2021 at 11:37:29PM +0900, Daeho Jeong wrote: > As you can see, if we're doing like the below. > > sbi->compr_written_block += blocks; > > Let's assume the initial value as 0. > > > sbi->compr_written_block = 0; > > sbi->compr_written_block = 0; > +blocks(3); > + blocks(2); > sbi->compr_written_block = 3; > > sbi->compr_written_block = 2; > > Finally, we end up with 2, not 5. > > As more threads are participating it, we might miss more counting. Are you sure? Isn't adding a number something that should happen in a "safe" way? And if you miss 2 blocks, who cares? What is so critical about these things that you take the cache flush of 2 atomic writes just for a debugging statistic? Why not just take 1 lock for everything if it's so important to get these "correct"? What is the performance throughput degradation of adding 2 atomic writes to each time you write a block? But really, will you ever notice missing a few, even if that could be possible on your cpu (and I strongly doubt most modern cpus will miss this...) But this isn't my code, I just hate seeing atomic variables used for silly things like debugging stats when they do not seem to be really needed. So if you want to keep them, go ahead, but realize that the number you are reading has nothing to do with being "atomic" at all. thanks, greg k-h _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel