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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 6A173C07E9B for ; Tue, 20 Jul 2021 23:01:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 475C860FF1 for ; Tue, 20 Jul 2021 23:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231992AbhGTWVM (ORCPT ); Tue, 20 Jul 2021 18:21:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:37620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231781AbhGTWUx (ORCPT ); Tue, 20 Jul 2021 18:20:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EA91060FE7; Tue, 20 Jul 2021 23:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1626822089; bh=lhlyWhR+QA4Nadqw1+VqW7eaBbIYDw7UbLsHTU9xbhY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=V/662+P5ivjol8w6OJbAwEaweq5TCtv8b9Jjg4sr8Cd4Gs4pMT+f23E5iYP4JVCWL X2qp4Uww4hZy5suv3t9jXoj1MxuRFaMdAE9ZGIbW19hP/Ic76San87002DiYtCj5nA cWRVtgTjpydexo+YCb8olMEuy7sZRNjt5RsYQt04= Date: Tue, 20 Jul 2021 16:01:27 -0700 From: Andrew Morton To: Xiyu Yang Cc: Alistair Popple , Yang Shi , Shakeel Butt , Hugh Dickins , Miaohe Lin , linux-kernel@vger.kernel.org, linux-mm@kvack.org, yuanxzhang@fudan.edu.cn, Xin Tan , Will Deacon , Linus Torvalds Subject: Re: [PATCH] mm/rmap: Convert from atomic_t to refcount_t on anon_vma->refcount Message-Id: <20210720160127.ac5e76d1e03a374b46f25077@linux-foundation.org> In-Reply-To: <1626665029-49104-1-git-send-email-xiyuyang19@fudan.edu.cn> References: <1626665029-49104-1-git-send-email-xiyuyang19@fudan.edu.cn> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 19 Jul 2021 11:23:35 +0800 Xiyu Yang wrote: > refcount_t type and corresponding API can protect refcounters from > accidental underflow and overflow and further use-after-free situations. Grumble. For x86_64 defconfig this takes rmap.o text size from 13226 bytes to 13622. For x86_64 allmodconfig this takes rmap.o text size from 66576 bytes to 67858. I didn't check which config option is making the bloat so much worse, but this really is quite bad. We bust a gut to make savings which are 1% the size of this! Is the refcount_t really so much better than a bare atomic_t that this impact is justified? Can someone pleeeeeeze take a look at what is happening here and put the refcount code on a very serious diet?