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 29C60C433FE for ; Tue, 22 Nov 2022 09:03:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD78C6B0074; Tue, 22 Nov 2022 04:03:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B88D180008; Tue, 22 Nov 2022 04:03:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A500F80007; Tue, 22 Nov 2022 04:03:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 93DD06B0074 for ; Tue, 22 Nov 2022 04:03:55 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5B56C160F40 for ; Tue, 22 Nov 2022 09:03:55 +0000 (UTC) X-FDA: 80160490830.03.F7B7CCD Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) by imf24.hostedemail.com (Postfix) with ESMTP id 10C08180012 for ; Tue, 22 Nov 2022 09:03:54 +0000 (UTC) Received: by mail-ot1-f51.google.com with SMTP id db10-20020a0568306b0a00b0066d43e80118so8937076otb.1 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=Yz1WnITePduTb3Q+tXnvBCvHf29SxDqcz8E68ZGuIUF32XcdNdxM/oSD/CbNGjUl1c oH4XT32fBdyve68sjsvDZCFqUQ0QvDIFypCWoPsDW0RUXcAZX0O99tRYbHPs6+VA3DQT LSc53KC5MaG3V9aBwaFk3ULrEi6h7pOt6PVyFhRd1inM2DALHnmYZbI2pjX7ZGq50Qgs jtO/z9YAYxLHLk0UpBS9xqghccD9oYtKoxTqcDxFwK1gxow0+rHSthrKzJW7Bl+lqW2S U0sWplCQQgYyXfVuBksw8UB8+YYHopyD/8LlUO4JjtmnliPLqVHHky/5qkD81Qz/nwIe RB1g== X-Gm-Message-State: ANoB5pkeq+ywZwW0a1VH6gzDcaY5SV6X1NHoD9mQS5lbfYsCeN74Qu/F SqMAXiP/M90OTyocMmBfqRBy8w== X-Google-Smtp-Source: AA0mqf4arlWtava+aAS17r8idiTw0ibTQJg1S/7J9O3jkEdwKj00BzelUsWSCveQKmcE50+0ieyKfw== 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 ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=BIkobYqd; spf=pass (imf24.hostedemail.com: domain of hughd@google.com designates 209.85.210.51 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669107835; a=rsa-sha256; cv=none; b=ixRrQym/9peEyIeGAddycC09Mvk9EQTDbUrl5hV78UCpl9VM7LtaxruQR/qHpzvZoObx/J vin4/EbZY8MtaCymdc/dIqwnDfGcyNQ5OjrAC6gqmFPoLillxs2NrkozFJp2TP2/j+dj8L N5n6sYThJpWwlwPN1VsdUCzDHOzSCzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669107835; 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=xxiV6Y0Y6sfCT/ieR4TcyBVO0torIXGTRcmTsYBc9t0=; b=mW45kG7zbrAoMf8mvrFTGTa0fd9azYMKRX/2PYkP4mS78LqN8rxhXgsy6tsAvDXjVz7IJx cM3TgsUUfHa07RmNoS4/f9hvj8im71F4ILpG9CNI69tvLoN9vnLgY9QDIZ3PSn3A837xTa WrgfeisgEjSH+sZim0l073GOYwyjV6Y= X-Rspamd-Queue-Id: 10C08180012 X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=BIkobYqd; spf=pass (imf24.hostedemail.com: domain of hughd@google.com designates 209.85.210.51 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam06 X-Stat-Signature: h9gz7rincfit76h8uec9h6kauh676wuo X-HE-Tag: 1669107834-802505 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, 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