Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5598878rwb; Tue, 22 Nov 2022 02:11:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf5k1/qXN9di0gQujzI/N6Pe+BnMneqO/tEBn7vfIUwcuPAo9Ssn+04MOL04VLMPRjXbXrO9 X-Received: by 2002:a17:906:a1cb:b0:781:fcf6:e73a with SMTP id bx11-20020a170906a1cb00b00781fcf6e73amr18812131ejb.352.1669111886446; Tue, 22 Nov 2022 02:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669111886; cv=none; d=google.com; s=arc-20160816; b=rG7h4gfqcNpFCymP3tsvHBvgaz6McF64OFAhVgxgpAL1YfZNPkI8gM3Ob+m+fJukhF uCPBtu/c6qVj43hPJlYgMfes72Vk862rSpLtrLuZAyKHbLsKJR+d8PYtAnsB42cI1IAR rzc/i7wrlnyetvxLp3NM0+8azuvWD1m4/0Oc4eNS7eXXDzvTQ0t0qks0JOsn5L51ThoE sfvT0MqC52/CORxT17vttf8eiPEezGcaLQe5amCBYOCvTEobxu4zZI76D+/0ftsOmvDX zfhUB7CUvUTbahL8NaddbqJrhFLs4hn2c+kKWNGH5rqULj0mVAT5VV53vWd7C1KQ/f+s Y07w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=xxiV6Y0Y6sfCT/ieR4TcyBVO0torIXGTRcmTsYBc9t0=; b=kCwBxeZJvzhOEbs69Wb2WoXyHXSAnjHt8phH8nkFT+Uhw3zv2pWcOkviFGo/47jD/R 1vNHXfnCCXW1/XW4V9Yd7g2/nt+vONcGQ3eZJ01Cbrl/eAb1q1W3OARz9WnhD/hMR0ai C2QS4T27OZn1WK/mHPoywPODTtGT5hXnjszuEo7cmIrUwOZraEGDQv4KzlWv1RMTQPzT edoBhmCr0zV+i/cEZqrgBcmLvlDUWTYmFy6xHpJ8YzrWiHesgm2Xl37NElHUA2yndhvr cXJv8Tq9hi8ayjtz5ljIyIz81W4i3vFLTjmNoM3D66f/FDPGp2EYNycA70AzJ7qrGdt/ dTwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=BIkobYqd; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa31-20020a1709076d1f00b0078dfe6dc4d2si9242741ejc.33.2022.11.22.02.11.03; Tue, 22 Nov 2022 02:11:26 -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=@google.com header.s=20210112 header.b=BIkobYqd; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233072AbiKVJEJ (ORCPT + 91 others); Tue, 22 Nov 2022 04:04:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233101AbiKVJDz (ORCPT ); Tue, 22 Nov 2022 04:03:55 -0500 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8051391E8 for ; Tue, 22 Nov 2022 01:03:54 -0800 (PST) Received: by mail-ot1-x336.google.com with SMTP id m7-20020a9d6447000000b0066da0504b5eso8902208otl.13 for ; Tue, 22 Nov 2022 01:03:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=xxiV6Y0Y6sfCT/ieR4TcyBVO0torIXGTRcmTsYBc9t0=; b=BIkobYqdKLM1FKhedwiDK5ICkJ4IaitoqlBHAnL55vXD7BRqxq5jfKgpaqrW0I70ko hyWSKYO8xgV471syHCqdDr1hbfbOgme2goGQytDv+JMs9qdiprVhZMKaekE9zwRXjjf5 U+Lx98xIX1aa1DssSrs9WUhBtzw0TKbpA3ih8tJ6wIeUH/NQmgNtPjYs7t/iFRhcnijQ 9nwYLB1wVmRdaKqQC4x1z+w9+OcEM+0kfEzCRm58F21LNLLInN+iyrujZJmmV0Wt6bws 3BC2Pq7QhCBXuNN1OPKAQi63USPM13ocD2mGb1t9zPow6/9BFt6ts1f7z0aKikVvMIkI 9S1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xxiV6Y0Y6sfCT/ieR4TcyBVO0torIXGTRcmTsYBc9t0=; b=ry30ArlH00/glmyzXZ8uyppWXjCJqgJAJmywJB7djhvBxjQZ2IJZNI3grU5zkIR0fA tphgQZogEc/MDJJFBr1smEiMvH6omN7QLuBxbkil/K6W6Kf6Ogih7hX72nF3Bfy5fkVT FHyZbBs6dHtfJQG+9BFYsx5Y8gw+5Zyyj2EAzu4zxKs4URvZg9V49BWhnI59XGIZ8p3v jKUGKF6YQ0lnZ58/4r0HWWVvCCiDSvGJ2oRg6c0nlvjQIMXSsTs0oNiuOPZwxD6ObZQb Cob1E4NbvFV+ma2t5zlygWNBbVmTZ2fU67XbvAkQmU5/oLIYMvmT8L9HjZ3nw+y+iTsk YLDg== X-Gm-Message-State: ANoB5plBui+gqXJl0nkgt1fFURXvmLgfa/QWaq5hAVXG1E+qXBwyGvDa MJG2EX1AgNM5m6OV04IZi4wUQg== X-Received: by 2002:a05:6830:6486:b0:661:170:49fc with SMTP id ck6-20020a056830648600b00661017049fcmr4033509otb.144.1669107834004; Tue, 22 Nov 2022 01:03:54 -0800 (PST) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id m25-20020a9d4c99000000b00661a1a48079sm5757697otf.7.2022.11.22.01.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 01:03:53 -0800 (PST) Date: Tue, 22 Nov 2022 01:03:42 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: "Kirill A. Shutemov" cc: Hugh Dickins , 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 1/3] mm,thp,rmap: subpages_mapcount of PTE-mapped subpages In-Reply-To: <20221121123638.4mp22wjmxz4gzhfz@box.shutemov.name> Message-ID: References: <5f52de70-975-e94f-f141-543765736181@google.com> <78fa518-85b5-32c0-ee92-537fa46131f6@google.com> <20221121123638.4mp22wjmxz4gzhfz@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Mon, 21 Nov 2022, Kirill A. Shutemov wrote: > On Fri, Nov 18, 2022 at 01:12:03AM -0800, Hugh Dickins wrote: > > Acked-by: Kirill A. Shutemov Thanks a lot for all these, Kirill. > > Few minor nitpicks below. > ... > > static inline void page_dup_file_rmap(struct page *page, bool compound) > > { > > - if (PageCompound(page)) > > - page_dup_compound_rmap(page, compound); > > - else > > + if (likely(!compound /* page is mapped by PTE */)) > > I'm not a fan of this kind of comments. > > Maybe move above the line (here and below)? Okay, done throughout. I wouldn't have added those comments, but Linus had another "simmering hatred", of the "compound" arguments: he found them very confusing. The real fix is to rename them, probably to pmd_mapped; or better, pass down an int nr_pages as he suggested; but I'm wary of the HPAGE_NR_PAGES build bug, and it wants to be propagated through various other files (headers and mlock.c, maybe more) - not a cleanup to get into now. > > > atomic_inc(&page->_mapcount); > > + else > > + page_dup_compound_rmap(page); > > } ... > > @@ -1176,20 +1157,16 @@ void page_dup_compound_rmap(struct page *page, bool compound) > > * Note that hugetlb does not call page_add_file_rmap(): > > * here is where hugetlb shared page mapcount is raised. > > */ > > - if (PageHuge(page)) { > > - atomic_inc(compound_mapcount_ptr(page)); > > - return; > > - } > > + if (PageHuge(head)) { > > + atomic_inc(compound_mapcount_ptr(head)); > > > > Remove the newline? It was intentional there, I thought it was easier to read that way; but since this gets reverted in the next patch, I've no reason to fight over it - removed. Hugh