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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC033C43217 for ; Mon, 21 Nov 2022 13:24:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E1438E0015; Mon, 21 Nov 2022 08:24:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 191B18E000C; Mon, 21 Nov 2022 08:24:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 031CB8E0015; Mon, 21 Nov 2022 08:24:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E769F8E000C for ; Mon, 21 Nov 2022 08:24:11 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B3E461C6653 for ; Mon, 21 Nov 2022 13:24:11 +0000 (UTC) X-FDA: 80157517902.04.FC61743 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by imf17.hostedemail.com (Postfix) with ESMTP id 07CD740014 for ; Mon, 21 Nov 2022 13:24:10 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 0E14C3200958; Mon, 21 Nov 2022 08:24:07 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 21 Nov 2022 08:24:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1669037047; x=1669123447; bh=go HhriPmNqgVzqWoz0ND7EocwpjpXPEn5qxwNPjIXSg=; b=Id1m2sP4DMPbLCTncm 2FtRqFLhncK04RL7vHhLHUwPqhkpUPItoejM0umsr7X6VvDOXM4zhimx4K3hbmGB eXxCXh2cnsreGKUrhB19peUvFjMSFHSNk1lYOxxI0OPXdnwPK6RK+JW0s07MDa7g bk+E9Wkl6Ic+FhAFtKod7hgxIMOjVwaAsmvNtX0GopeR17i6KNQ17C45Qbap/7V0 VeHlrRBXwYcHogCsr+lcmtdRiEJMjV1031cAE2szuAVmAeUDk31S/Z6J9lyKDgSU eKRVpgG0gWjsy+HRQeJ2HeG565DKCNcKcVpdn0q9y2hTlZE4bol40ScjkilDc4AW vfDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1669037047; x=1669123447; bh=goHhriPmNqgVzqWoz0ND7Eocwpjp XPEn5qxwNPjIXSg=; b=Z9WLe9WiuyUTaxQldSvu7z0FfOcGZYwQWTEKk1WtzLHQ cgNRE6B2lXpobH1L8Wl8yh+vrwwXBezQ1AvRziFWv7QbaqGYHdp2bIV+ZAOKpC7B OGXorQFThUNc0+ZhOQQ23z3CHB8JAzaRy0CYr5egt9nzFMd4DU9pAQJWNV3xmEgJ 1D5BUvWLUzia4vTr3f1NV8PfFp+SoXTT7IcIHfqygEcdwNs1klewXEE6nmZlwuVZ QtM+h7CxS8QfFmtw99Q1+nuI3jhn1KzvuLlAUjN6Fad9FGJzu/zxS6TKvxCg6SiP h6VDoTtyH9X0J8H0i5P8k4jf9WRpbTFHe4V9ojjWyg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrheeigdehtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttddttddttddvnecuhfhrohhmpedfmfhirhhi lhhlucetrdcuufhhuhhtvghmohhvfdcuoehkihhrihhllhesshhhuhhtvghmohhvrdhnrg hmvgeqnecuggftrfgrthhtvghrnhephfeigefhtdefhedtfedthefghedutddvueehtedt tdehjeeukeejgeeuiedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepkhhirhhilhhlsehshhhuthgvmhhovhdrnhgrmhgv X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 21 Nov 2022 08:24:06 -0500 (EST) Received: by box.shutemov.name (Postfix, from userid 1000) id CD83F109A30; Mon, 21 Nov 2022 16:24:04 +0300 (+03) Date: Mon, 21 Nov 2022 16:24:04 +0300 From: "Kirill A. Shutemov" To: Hugh Dickins Cc: Andrew Morton , Linus Torvalds , Johannes Weiner , Matthew Wilcox , David Hildenbrand , Vlastimil Babka , Peter Xu , Yang Shi , John Hubbard , Mike Kravetz , Sidhartha Kumar , Muchun Song , Miaohe Lin , Naoya Horiguchi , Mina Almasry , James Houghton , Zach O'Keefe , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 3/3] mm,thp,rmap: clean up the end of __split_huge_pmd_locked() Message-ID: <20221121132404.sebpecbc5joto7h7@box.shutemov.name> References: <5f52de70-975-e94f-f141-543765736181@google.com> <2f4afe60-40d2-706c-af21-914fbbbd164@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f4afe60-40d2-706c-af21-914fbbbd164@google.com> ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm2 header.b=Id1m2sP4; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=Z9WLe9Wi; spf=pass (imf17.hostedemail.com: domain of kirill@shutemov.name designates 64.147.123.24 as permitted sender) smtp.mailfrom=kirill@shutemov.name; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669037051; a=rsa-sha256; cv=none; b=SUxOO84jgcA16zIradG+pD5DtvhYPk3LTlhKh6lVf34eIP8h4rGcDoBJTuFYon454wMQOt HQVrksmmICRZa4Fc/DworkWApPYaGTgEyd2Fq5W7BzIO4xuLhSM8x2qV8no4QLS6EZOCp/ 68r9D3owUA2JGDm+AQfl8JenXquJ82c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669037051; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=goHhriPmNqgVzqWoz0ND7EocwpjpXPEn5qxwNPjIXSg=; b=vUkIkNNPh2kIt4t3GqHOMlNte4910nRXNIIs4MgD4FRklxIOFQBhjI6qBaWOgGJZW6lNJE JyM/zUyE6GN5tk+Y7u61CAx6ssxdS/g8W99NEyE8DIgi8hyRdaYYlKWsZMfyxfiwmo9oM1 r947XIId7Als6SZBCLjCb2Z2Y/jy+qE= X-Stat-Signature: 4th13qtk5dtbpeazxtu817bhcip8hwdg X-Rspamd-Server: rspam08 X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm2 header.b=Id1m2sP4; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=Z9WLe9Wi; spf=pass (imf17.hostedemail.com: domain of kirill@shutemov.name designates 64.147.123.24 as permitted sender) smtp.mailfrom=kirill@shutemov.name; dmarc=none X-Rspamd-Queue-Id: 07CD740014 X-HE-Tag: 1669037050-719512 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 Fri, Nov 18, 2022 at 01:16:20AM -0800, Hugh Dickins wrote: > It's hard to add a page_add_anon_rmap() into __split_huge_pmd_locked()'s > HPAGE_PMD_NR set_pte_at() loop, without wincing at the "freeze" case's > HPAGE_PMD_NR page_remove_rmap() loop below it. > > It's just a mistake to add rmaps in the "freeze" (insert migration entries > prior to splitting huge page) case: the pmd_migration case already avoids > doing that, so just follow its lead. page_add_ref() versus put_page() > likewise. But why is one more put_page() needed in the "freeze" case? > Because it's removing the pmd rmap, already removed when pmd_migration > (and freeze and pmd_migration are mutually exclusive cases). > > Signed-off-by: Hugh Dickins Acked-by: Kirill A. Shutemov -- Kiryl Shutsemau / Kirill A. Shutemov