Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1753917pxj; Sat, 12 Jun 2021 20:17:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbkSvWfKo7/elfH0uRefKfOw1sDy3N+nFrnQpPtQEhzDXViaUH6LqLWmxhm2hikPFmWVEY X-Received: by 2002:a05:6402:4301:: with SMTP id m1mr11075743edc.303.1623554226059; Sat, 12 Jun 2021 20:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623554226; cv=none; d=google.com; s=arc-20160816; b=ZSCutgiiDErfIt1nX+NVQpvsUfEFZJwvS0WdSqLoMNZVg9W7J3tiEO/9j07/lBNhNZ XJGI48qvNKd/gVUkyO3O3c6x85wA59CiTTE62BZOQCNXzGtsGoToX9xFlj045twdw8OI RwU5CAuMPm/dvjMpeeJEAT7sNDPIUyTqjBnFEx54aDKK0gqEvyhivweZVp0eh1S9whu4 jOLyWcE/PhSNu3LM19aFseGPzSZi+dwCRO2kP8h7BrZ6Lol/KK6mkfTkHqtb2BKkUR5t Wcq+GKjihNjNR6fJad9R81OjmEQ77llw33nFIb0D2jpEAM6gyGZNYUtZEgjlrMF2nnzz 6OLQ== 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=V1RhSAK4oVzydpmUQrb0ucBxFw+KSa5ml799NQIt2x4=; b=BN3ia9T213J757Gwj5pbaqj5MdoEelsvX8PtuElMnQyTgQ1rdI6eT/a7AP7pNb02Jc g8dIHmzdFdMZ9E4IhIiObXT5FLNU2H7DwEKTO1b/3v+iyVPDqH8FTm6biqs4dg7f8AL2 Y7y9o3CzeD62mItjVV9FCjghQCQ1zu2mjt4XpSNmUJW6Ho9KKxSVDF/9jCmsCoR/z37/ pVrNz4lW3uZsecAht5KicG2ol6gtIwoC5taffNv+E/gU2P9PFzF/NowSah5z2iviR4vq iKhxKPbzMh53ImQCcAiofapMNU2GNeX7D8UVF5sleTecpFkYCq49jYCmaOKaDX6lc2kp OFvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=udX1W5pJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si8704312edz.434.2021.06.12.20.16.32; Sat, 12 Jun 2021 20:17:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=udX1W5pJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231556AbhFMDRM (ORCPT + 99 others); Sat, 12 Jun 2021 23:17:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230136AbhFMDRK (ORCPT ); Sat, 12 Jun 2021 23:17:10 -0400 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF5F8C061574 for ; Sat, 12 Jun 2021 20:14:53 -0700 (PDT) Received: by mail-ot1-x333.google.com with SMTP id 7-20020a9d0d070000b0290439abcef697so1881565oti.2 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=cDkMjve0lP7myQ/Q4zWTLnpxWwj7JnfdpgwMBHCbw406kQg60L82EE67dzFfUEfMsT yDVeXV5iBLSF+xdWrduUrrAOPCWaZE2u9CUD1VMozsd7AVgoV84J7UQhmS/EWn4bQyrB gFSa21HCmwkhSMKe8M5G3g2FryDdcHoGkRqDhwnc3JmH6KNcQOQDvugNVGKWYvYBoSoV 6zeL9tBcUdRYKUzK4cEH9MnlhFTpR7sHKMiJtaA34c4WzF/FBQ+XutN8zV4jcJNRRlCV aCufd99tOvlHgVOly58HDT98KD1HYLF8Z4UAmkmkl0xNS/wvTwtB0NTdJZzqbZbcFUQ2 Eymg== X-Gm-Message-State: AOAM531m9GojyNsFXP+52Cnjb8Nn/EIXCyx/cDDFolb7M8EE6AMRzFSs oy0Occqh5KyJ7TSOKyiNPWA//A== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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