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 47586C433EF for ; Fri, 17 Dec 2021 17:30:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D78096B0074; Fri, 17 Dec 2021 12:30:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D4D7E6B0075; Fri, 17 Dec 2021 12:30:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEE936B0078; Fri, 17 Dec 2021 12:30:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0251.hostedemail.com [216.40.44.251]) by kanga.kvack.org (Postfix) with ESMTP id B0A596B0074 for ; Fri, 17 Dec 2021 12:30:44 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 77276180DA17B for ; Fri, 17 Dec 2021 17:30:34 +0000 (UTC) X-FDA: 78927975588.11.856BE19 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf01.hostedemail.com (Postfix) with ESMTP id A5BCB40017 for ; Fri, 17 Dec 2021 17:30:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639762233; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XpYrlXQGuGiTurswQoKfair4c1yoIHCy4su7rQT1jtY=; b=YdIM1VtZ8v/0V3zMitEIwSscVBefKBQhSpQSFba5BxxEQN5YKDAqQtma7Gvx/llhpGjVwF qJLr6HCLJfYEK4Z0WQK4KaVpjJb75C3osA3FKudyoWu7IMXY2B75O5jO7q2NqZzArZln/y 6ijMmlaW2Q8tnnvF33zmxv5MW6BHFFQ= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-4TW4GH4DMpKdjHcIquq01g-1; Fri, 17 Dec 2021 12:30:32 -0500 X-MC-Unique: 4TW4GH4DMpKdjHcIquq01g-1 Received: by mail-wr1-f72.google.com with SMTP id q21-20020adfab15000000b001a24b36e47eso825285wrc.2 for ; Fri, 17 Dec 2021 09:30:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=XpYrlXQGuGiTurswQoKfair4c1yoIHCy4su7rQT1jtY=; b=4MH+Ht3pkj75Ar2zB6qOK39JofOxNY2Qc26RcPR8C6Poe7dnoOBV6fTsPv9AZgu/Bk FlIoDe8gLBYyanGMD6ceh6bxRS0EJDzzN+LXIoTpJusIGBQdQP555F4tTZ7Hea+cjMwN JW6gmxN7TJlGLgoYdzBjTbvLRIQkMqF+TzBDx6nLGtmP8qrEzhoXE41IWJdsngI196Vj k26vakys4U3egCyelonz8Lv+MaY3A+pmodHb5drraeEboTTWCh/2E0Z7BhYDYGThLoFT Ppxacqr4Mn3WgIJALZAw2tuB6SFQyxDvDpZe6YMFgvavJ2pfvmakflGStGw7gntReSU6 43XQ== X-Gm-Message-State: AOAM533EOzTS45VvMikzxlZGzWUIGWjBJBNpoq6YBHg3qXzw4WBQHLqw JWzw9HVYCBqEthv0Qq6mlzgB3B7wtuC/zIZrMmHvjXw00hV7QjlMlSpao4QGaFa/x3aEyc3jwFS x0J6TEcVv12c= X-Received: by 2002:a5d:6e85:: with SMTP id k5mr3514781wrz.545.1639762231065; Fri, 17 Dec 2021 09:30:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrXMA9V67jpui+rmft7WNUVQD8C+zSHOzezyGLBEqcDkWsoghcyJDIaNnyt3ahYOR9kJWzYQ== X-Received: by 2002:a5d:6e85:: with SMTP id k5mr3514742wrz.545.1639762230870; Fri, 17 Dec 2021 09:30:30 -0800 (PST) Received: from [192.168.3.132] (p4ff234b8.dip0.t-ipconnect.de. [79.242.52.184]) by smtp.gmail.com with ESMTPSA id y15sm11233959wry.72.2021.12.17.09.30.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Dec 2021 09:30:30 -0800 (PST) Message-ID: <8b2a8dc7-bad6-7c0f-12f8-a79c68f84508@redhat.com> Date: Fri, 17 Dec 2021 18:30:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v1 03/11] mm: simplify hugetlb and file-THP handling in __page_mapcount() To: Nadav Amit Cc: LKML , Andrew Morton , Hugh Dickins , Linus Torvalds , David Rientjes , Shakeel Butt , John Hubbard , Jason Gunthorpe , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Vlastimil Babka , Jann Horn , Michal Hocko , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , "linux-mm@kvack.org" , "linux-kselftest@vger.kernel.org" , "linux-doc@vger.kernel.org" References: <20211217113049.23850-1-david@redhat.com> <20211217113049.23850-4-david@redhat.com> <10A6B16D-3570-4010-83B9-41A38B50C8A4@vmware.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <10A6B16D-3570-4010-83B9-41A38B50C8A4@vmware.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A5BCB40017 X-Stat-Signature: a1irus5194oz4h3sjmkzcb41w6tyf3mk Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YdIM1VtZ; spf=none (imf01.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1639762228-373825 Content-Transfer-Encoding: quoted-printable 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 17.12.21 18:16, Nadav Amit wrote: >=20 >> On Dec 17, 2021, at 3:30 AM, David Hildenbrand wrot= e: >> >> Let's return early for hugetlb, which really only relies on the compou= nd >> mapcount so far and does not support PageDoubleMap() yet. Use the chan= ce >> to cleanup the file-THP case to make it easier to grasp. While at it, = use >> head_compound_mapcount(). >> >> This is a preparation for further changes. >=20 > It would be useful to add =E2=80=9Cno functional change intended=E2=80=9D= or something. Absolutely, same applies to other "simplification" patches. >=20 >> >> Reviewed-by: Peter Xu >> Signed-off-by: David Hildenbrand >> --- >> mm/util.c | 11 +++++++---- >> 1 file changed, 7 insertions(+), 4 deletions(-) >> >> diff --git a/mm/util.c b/mm/util.c >> index 741ba32a43ac..3239e75c148d 100644 >> --- a/mm/util.c >> +++ b/mm/util.c >> @@ -732,15 +732,18 @@ int __page_mapcount(struct page *page) >> { >> int ret; >> >> - ret =3D atomic_read(&page->_mapcount) + 1; >> + if (PageHuge(page)) >> + return compound_mapcount(page); >=20 > Before you return, perhaps you can add an assertion like: >=20 > VM_BUG_ON(PageDoubleMap(page)); >=20 > This would be make the code clearer and would ease debugging in the > future (if support for double-map is expanded). >=20 I'd probably have to add this to a couple of places -- and I assume anybody working on that has to grep the kernel for use of PageDoubleMap already. Thanks! --=20 Thanks, David / dhildenb