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 X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 663C3C48BCF for ; Sun, 13 Jun 2021 03:14:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B0522610FC for ; Sun, 13 Jun 2021 03:14:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0522610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F1B296B006C; Sat, 12 Jun 2021 23:14:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB8746B006E; Sat, 12 Jun 2021 23:14:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0B286B0070; Sat, 12 Jun 2021 23:14:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 9DF196B006C for ; Sat, 12 Jun 2021 23:14:54 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2A352180ACEE4 for ; Sun, 13 Jun 2021 03:14:54 +0000 (UTC) X-FDA: 78247232742.01.620B030 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) by imf12.hostedemail.com (Postfix) with ESMTP id C3CAAFF for ; Sun, 13 Jun 2021 03:14:43 +0000 (UTC) Received: by mail-ot1-f43.google.com with SMTP id o17-20020a9d76510000b02903eabfc221a9so7400235otl.0 for ; Sat, 12 Jun 2021 20:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=V1RhSAK4oVzydpmUQrb0ucBxFw+KSa5ml799NQIt2x4=; b=udX1W5pJGANq3Dsx0jMAqmwsZyYb3W8BUgJticS9c2o6F/Aq0I6yLX37uzbCeGA5kX +rZNVVmokeAqQH4stnACV7GnyjycmcpIkZWCkauN1CR+n7LsEMfY2KnSb0XNOPAhVR7W jlqZMFEZ6HLgoh0DCH3q75insAA7elTwAvBrtPEJvGre/IKsg7eMWLfHXCr3x0GdrS72 2/z5bEu0n2K+Nj5kXv1qbCN2NEaYAtXQ1h+0wDlksDl6/p7B7UoNSiTCsSVa//Kf295C dmP49ZnO6Eq07Qk+KERarQEs4pqFp0cZ+4VXGA3KorFkRnwO33FjyjUeNjFuqTyHRE0k ufVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=V1RhSAK4oVzydpmUQrb0ucBxFw+KSa5ml799NQIt2x4=; b=qsgX0+d92+HSbfY4Tl6Gf/Ll3H3+knkD5+rTA75EiBnqxS9kr8Lonv3TPqrzGGhlJn hm3oNigVYLaa33nwDwMS5R2bAd1o0h6ePuTpkjMFI+1Mjy69JglCEw7EXbSNH2fqG5qB F+F4GE+5I6GuIOwmkDfStNNkJ7n1vddPjHoWmQcKZIcUboFh+XlvIOBE4iYDPcIPImZv +k7cKeksts1wgLVExI3KzUhGjMNR/x3oDFMz0O7JLKwwAKBDYqKXKs2wvt8wRJy9lLVE 2NjGuZey4EHR6T/Pz7ybjGHq1fdJPn7hrEU1w6tibTRuGcKJ43S1WNZrcghMobh35nGi NwRA== X-Gm-Message-State: AOAM531q6e+8FBp/O/uJ9vcvg0u+HCuwgiRQM/9Y/EffyjZVaqJQMnnP MpBLW7P4hDR9FkqnlQLptQlZCw== X-Google-Smtp-Source: ABdhPJw4CIm2xgPkqqgcbzU8rgkoYbZHVBy9u7p4ht7ZdRaAcqvBZV1VPMOUA8Wq2el5T0qOU9KeVg== X-Received: by 2002:a9d:7e97:: with SMTP id m23mr9393388otp.286.1623554093026; Sat, 12 Jun 2021 20:14:53 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id a7sm2214353ooo.9.2021.06.12.20.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Jun 2021 20:14:52 -0700 (PDT) Date: Sat, 12 Jun 2021 20:14:37 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Matthew Wilcox cc: Hugh Dickins , Andrew Morton , "Kirill A. Shutemov" , Zhang Yi , Mel Gorman , Mike Kravetz , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , Davidlohr Bueso , Neel Natu , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm, futex: Fix shared futex pgoff on shmem huge page In-Reply-To: Message-ID: References: <45e8fd67-51fd-7828-fe43-d261d6c33727@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: C3CAAFF X-Stat-Signature: npdmgzhg61xyg4ry4mxqbmh5hwceawzk Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=udX1W5pJ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf12.hostedemail.com: domain of hughd@google.com designates 209.85.210.43 as permitted sender) smtp.mailfrom=hughd@google.com X-HE-Tag: 1623554083-306871 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 Sat, 12 Jun 2021, Matthew Wilcox wrote: > On Fri, Jun 11, 2021 at 09:31:16PM -0700, Hugh Dickins wrote: > > +++ linux/include/linux/pagemap.h 2021-06-11 17:30:28.726720252 -0700 > > @@ -516,8 +516,7 @@ static inline struct page *read_mapping_ > > } > > > > /* > > - * Get index of the page with in radix-tree > > - * (TODO: remove once hugetlb pages will have ->index in PAGE_SIZE) > > + * Get index of the page within radix-tree (but not for hugetlb pages). > > */ > > I think the TODO should be retained. It's still something that I > intend to do. Okay. I did not mean to imply, by removing those TODOs, that they should not be done: just that they were a developer's notes to self, that I found distracting there. I've restored both TODOs (but changed the second to say "hugetlb pages" explicitly, rather than the ambiguous "hugepage"). > > --- 5.13-rc5/mm/hugetlb.c 2021-06-06 16:57:26.263006733 -0700 > > +++ linux/mm/hugetlb.c 2021-06-11 17:30:28.730720276 -0700 > > @@ -1588,15 +1588,12 @@ struct address_space *hugetlb_page_mappi > > return NULL; > > } > > > > -pgoff_t __basepage_index(struct page *page) > > +pgoff_t hugetlb_basepage_index(struct page *page) > > { > > struct page *page_head = compound_head(page); > > pgoff_t index = page_index(page_head); > > unsigned long compound_idx; > > > > - if (!PageHuge(page_head)) > > - return page_index(page); > > - > > if (compound_order(page_head) >= MAX_ORDER) > > compound_idx = page_to_pfn(page) - page_to_pfn(page_head); > > else > > > > urgh. this trailing bit should be: > > #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) > compound_idx = page_to_pfn(page) - page_to_pfn(page_head); > #else > compound_idx = page - page_head; > #endif I don't see what's wrong with what's there, myself. Unfamiliar territory to me, but mem_map_next() appears to have the same MAX_ORDER expectation. Or perhaps you're just suggesting an optimization. If it were obvious to me, I'd have gladly folded it in; but no, please send your own patch for that, running it by Mike Kravetz and Mike Rapoport and David Hildenbrand, I think. Thanks, v2 follows, Hugh