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 X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 EF866C43457 for ; Fri, 9 Oct 2020 19:49:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B137F22284 for ; Fri, 9 Oct 2020 19:49:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="O6RjKK0k" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387543AbgJITtJ (ORCPT ); Fri, 9 Oct 2020 15:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726357AbgJITtJ (ORCPT ); Fri, 9 Oct 2020 15:49:09 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C95BCC0613D2; Fri, 9 Oct 2020 12:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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; bh=SgvnNpfrn/MQMIyMBQmEYFVyluHsUQhVV6DoGEDgBqo=; b=O6RjKK0kDe2iMy3GLV3oIIq2oN IB15xKddQd7Mfkgxd2Vns4iMhF2EVRKrxIEI4xHFHPwCvP9Z/CpBIndui79fYtk3Jm/y+NtQqxts4 W/Jk17ahq6iiwfP9stgh1OyZVXDdrsTFdsZNO+qqI7NliDn9dWpUGU1+zrMNc+qjooFwlSrxiE4sU dygTP6d08WwvXSR4oo5C/yGWSEM7WF3Hxh3A7n7/qeRjlU/T4QRW7RI7FTCsTHj4fTlMX1OvmD3FB wjddfZtq2K72AVAHBlwGOeN3JUQuEpJ90V5wGRYeVgleekZ2TRfv9sj1rEot3KFLxwOvGktOMJBCC k1V+9Jsg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQyO1-0000y4-Q9; Fri, 09 Oct 2020 19:49:05 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C1F0B30008D; Fri, 9 Oct 2020 21:49:04 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AEDB820AEA646; Fri, 9 Oct 2020 21:49:04 +0200 (CEST) Date: Fri, 9 Oct 2020 21:49:04 +0200 From: Peter Zijlstra To: Shuah Khan Cc: corbet@lwn.net, keescook@chromium.org, gregkh@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 01/11] counters: Introduce counter_atomic* counters Message-ID: <20201009194904.GB1073957@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Fri, Oct 09, 2020 at 09:55:56AM -0600, Shuah Khan wrote: > Introduce Simple atomic counters. > > There are a number of atomic_t usages in the kernel where atomic_t api > is used strictly for counting and not for managing object lifetime. In > some cases, atomic_t might not even be needed. > > The purpose of these counters is to clearly differentiate atomic_t > counters from atomic_t usages that guard object lifetimes, hence prone > to overflow and underflow errors. It allows tools that scan for underflow > and overflow on atomic_t usages to detect overflow and underflows to scan > just the cases that are prone to errors. Under- and overflow on atomic_t is perfectly fine. We're not going to create pointless wrappers for this. What tools, and how could they not be served by adding annotations to variable declarations?