Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4260093rwb; Mon, 21 Nov 2022 05:45:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ECSwbbD+xSEGWuejZK5JJh2F79Kh08VKzImd8UJK9KhmPSYQHmDeW1tF77dTvR6xLl7cA X-Received: by 2002:a17:906:29cc:b0:78d:a836:1d88 with SMTP id y12-20020a17090629cc00b0078da8361d88mr117113eje.470.1669038328591; Mon, 21 Nov 2022 05:45:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669038328; cv=none; d=google.com; s=arc-20160816; b=jSL6+xe1Ds2sMQ4YPkwaHr7x2jbT2LjL1EiOENWyuA0CsuAM4gfQh0/jR4kTcxBkCy AGPABmcZQ9vXlXPz6mJXZnRPoUSVOPYoscL3kj9nVJSLOUr24nU9JmTkQ4bY8BI417PR 8ghusVgP+3ko+ln17cQyFK205eKKsTG1YQHGx05mp7+mJnN6qdoCyhhPjj85z3PEyMKo oWuqZIiu2vduB3mO4RWLHO48c/t34yq0TmO4DTf3aITLTD6ASFQ1t2YhezbSZtyuDWIy PcWNhJKo80WDPIJc5LIkmq/XGbp2majNcakbHHqMBTqKloAW597YrCbeAq2wc5gNABNE Yeag== 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:feedback-id :dkim-signature:dkim-signature; bh=goHhriPmNqgVzqWoz0ND7EocwpjpXPEn5qxwNPjIXSg=; b=HIUaV/bDbhXDwmh936S1lfBsetn7LQZsC5hGVil9biYqcXaAMG55DFISTQtSR7wWxy TrZY12OkNlxvS4UcwC1kYpexDyGglPsZpPfkkG8Oo4NEeZw/sYPkhquDIgtgbwAgzDrT 76e2S53zxb+WEj/LU/LGdg+SbhXv/Gl9Qr+nC66v7C2NI9IXw6lNj8m9aso5Z8pdmODh ypboH1lChucclA00KULyV23h1qI+y3OKYmfW1b40dbTofet8rv1/yVKMUKuqgta4Efxq QjIAOhRcC1P4YMx94ArsR91cri8vI1DeK4uLlspeQYcOZHjLMfYVxYtm+Q8/eq+4Rxzx Pj9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm2 header.b=Id1m2sP4; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=Z9WLe9Wi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a170906138700b0078e063fc78csi7686342ejc.576.2022.11.21.05.45.04; Mon, 21 Nov 2022 05:45:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm2 header.b=Id1m2sP4; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=Z9WLe9Wi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbiKUNYM (ORCPT + 91 others); Mon, 21 Nov 2022 08:24:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbiKUNYL (ORCPT ); Mon, 21 Nov 2022 08:24:11 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 334C94090C for ; Mon, 21 Nov 2022 05:24:10 -0800 (PST) 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> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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