Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp651892pxb; Wed, 27 Oct 2021 09:42:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ1blLc01hWE/mYfA8h5QvEI2iWwNPrdnjOhgbl5aCmYqEAflyXlMWOKi/Au4C7CvTQEMZ X-Received: by 2002:a17:90b:3811:: with SMTP id mq17mr7009166pjb.97.1635352964204; Wed, 27 Oct 2021 09:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635352964; cv=none; d=google.com; s=arc-20160816; b=uqlaC3Ha9RNG8S9dZSDr1Z4PJbN7AKuvacMoeyOxJjq2OC9Yx9zYs9XHupl/N+tvuH gr95mniW/xiDCONBMYimqO3NlO8v33P6TeK/8RUCAwd82WxuI+A5LdgEwrykfxb+MJwB LjHw6y23eXD4iGWEmUVQPAMZ+B7bWdvW6z1QXXNmhz3h0dtQfrEte3DuypmJM6HN9Pyo X36bDoMTPVLiziBSQzhPp+Zz5GhP1PBH3qozikE7ZbD9bZlbs1xTfm1DMlJhT5tDdPKT 1httxzu64yMpPkJ6RGNKF+pIwTyJzVblCxPblo81wTNji1EHGpxcLD0evKbSrIdpxe3q Ky9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2QEJl6ydeEpfVKPrusTfke/4wYUwA/hZSkA+vyln7I4=; b=G7M9U6ISwIkhfu+ayFsHvNR/BglI5jGaxDgNcsSEuz8XBJ0w0NIE+cBajTsPtvRBFU pormnbryuC0RfG2998YCDT3rwV2oUiLx1hmIdzxz9X23Wl7VYezincO/DCwY+oYhyTQE xU2kpRWPYIYj5KpHaWflFuFO9dGJVCXJJyEU12/PltTgmK4XsFxAz+j4wE+YA6I1+eTr vT1ynrr/KZQMw2NvxNKRKecEIljPZjNdVsXev7nwXFxI6vI619JgWh7TTUsTioXqvgBE 9+LLKRvGuehcSYAMJpvdKRTk06+IF/C4Oan7PZGQlrxYQ5xAp0/haXfrkN75g1OXdPta vfbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tWHS4LIS; 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 h34si557086pgh.340.2021.10.27.09.42.03; Wed, 27 Oct 2021 09:42:44 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tWHS4LIS; 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 S238866AbhJ0DH4 (ORCPT + 99 others); Tue, 26 Oct 2021 23:07:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237627AbhJ0DHz (ORCPT ); Tue, 26 Oct 2021 23:07:55 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17376C061570; Tue, 26 Oct 2021 20:05:31 -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=2QEJl6ydeEpfVKPrusTfke/4wYUwA/hZSkA+vyln7I4=; b=tWHS4LISDxbKziMnxAcTz+Mcs+ SOQRHzJMYyj2jwxGsZL8mQS8UGJhSFqDucTtCx23L7GkfDKrQt3XJw7UyC4DP+jn381BlRnbI/Ojj 3xjGmUHs6jBwtinLLrdkUs8uOPzvwHcBqJZ745+eoJ2hyMJ2M18lXh8x/b4nOYfdBdlLJhTwlsM9U 28qKZnMC9XgIVzmW4X9vMMLoeoD3chIRIuNgiOmOFPbVamvi/Jocg1BFWuBf1SSKWqTkRnulsnShJ DWI2AmaSc+1f4SmiSuwz2LrSCaToOKGi34n6AWQEreGWZXYb0QyrxeBCLTXvLSBNZuIzo6b1w3a2f niCz7ykA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfZF5-00HLvL-C4; Wed, 27 Oct 2021 03:04:56 +0000 Date: Wed, 27 Oct 2021 04:04:43 +0100 From: Matthew Wilcox To: Pasha Tatashin Cc: LKML , linux-mm , linux-m68k@lists.linux-m68k.org, Anshuman Khandual , Andrew Morton , william.kucharski@oracle.com, Mike Kravetz , Vlastimil Babka , Geert Uytterhoeven , schmitzmic@gmail.com, Steven Rostedt , Ingo Molnar , Johannes Weiner , Roman Gushchin , Muchun Song , weixugc@google.com, Greg Thelen Subject: Re: [RFC 1/8] mm: add overflow and underflow checks for page->_refcount Message-ID: References: <20211026173822.502506-1-pasha.tatashin@soleen.com> <20211026173822.502506-2-pasha.tatashin@soleen.com> 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-kernel@vger.kernel.org On Tue, Oct 26, 2021 at 09:21:29PM -0400, Pasha Tatashin wrote: > I think we can do that by using: > atomic_fetch_*() and check for overflow/underflow after operation. I > will send the updated series soon. Please include performance measurements. You're adding code to some hot paths.