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 5EB7CC07E9B for ; Tue, 20 Jul 2021 23:01:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E56E06101E for ; Tue, 20 Jul 2021 23:01:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E56E06101E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 539E46B0011; Tue, 20 Jul 2021 19:01:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EA666B0036; Tue, 20 Jul 2021 19:01:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B1046B006C; Tue, 20 Jul 2021 19:01:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 1266F6B0011 for ; Tue, 20 Jul 2021 19:01:33 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8717818425A9F for ; Tue, 20 Jul 2021 23:01:31 +0000 (UTC) X-FDA: 78384489582.05.EBD43B1 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf09.hostedemail.com (Postfix) with ESMTP id EC7163001DA7 for ; Tue, 20 Jul 2021 23:01:30 +0000 (UTC) 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 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="V/662+P5"; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=temperror reason="server fail" header.from=linux-foundation.org (policy=temperror) X-Stat-Signature: w9nd1fmiptod8e746yjrubx1d1eub3db X-Rspamd-Queue-Id: EC7163001DA7 X-Rspamd-Server: rspam01 X-HE-Tag: 1626822090-177764 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 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?