Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp222165pxb; Thu, 12 Nov 2020 01:58:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzliuqOeCue56nvGFMTxXaKNVTmZAyisIQTyVw6CKL36hfJThVfa67Mj4UGDh4Q/pv9XWvJ X-Received: by 2002:a17:906:5a88:: with SMTP id l8mr19652712ejq.407.1605175083818; Thu, 12 Nov 2020 01:58:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605175083; cv=none; d=google.com; s=arc-20160816; b=Ad+4dww/cUrbDyKFrwK5OWmZDvRC9oHSn19XW2Lw3Z/LOQe9oDq4XMYtZ2S50otSqz LCxPr079frNvH9NPnLSHDIXpctRjTd1g4PFSYJHHPwNQFiUR5NSU+/sUwXbgycX1zdsi 9PetgpQgQZJal03BiuslgJg7wSaAJnqA/yAY0Jzh7Vyms2yKATWVDz9dBvHLc2GYCukK /0B6g9s88LVAPB7QkEpktdC/qhIoWIyVYu4CL/ys8zS9WPTzhXfdc5r0tcQaETqE3VzJ Pt/wW2b+YCx/fz2kok76MQKn/+g7boKQheuYUO0zc2uihZwuY2pTb5VaVIXTXhakac6j xQdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jJejUeKLBULZ8PRU4NtuaT8Pq4mGMISunKtpYvXCAVw=; b=qjKR6zmKRylIf8/YkIbfacbYCDwSkZZO6tmuqSEzgIMedGPiybP6gM5XCI5h8RIRkZ MJgA3Zx46Lm81JVWZRhEff5+I31MOWpyQ2Umh7k5fIh6VP8fdIYVRC+RKx2F3qTobs9e 5YiwBYN+s1nvwFXy0j7cHGoZoY/Fm8X3vbt9qTDfwwUnHNeaUci+WptRwRgibOjFjb9/ Yt5J0qxlv1DjBKMpolkgY2kTjPNL4FlPYjaDGVi4HHJb3Gc29p6ud6S6/9xkpD4Ocdzw r7x1dutvZxGu53nVS3i2REp5ZJ0UybB0iSFybNkQqMl9k52OTRSeSyoZcrYHVkiOWYFa K5rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GMZUTCxV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si3549169edp.550.2020.11.12.01.57.40; Thu, 12 Nov 2020 01:58:03 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=GMZUTCxV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727861AbgKLJyn (ORCPT + 99 others); Thu, 12 Nov 2020 04:54:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726061AbgKLJyn (ORCPT ); Thu, 12 Nov 2020 04:54:43 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E765C0613D1 for ; Thu, 12 Nov 2020 01:54:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jJejUeKLBULZ8PRU4NtuaT8Pq4mGMISunKtpYvXCAVw=; b=GMZUTCxVhDr8JLf2BZZRLQCY5T fOGZyhPCNsyL27fL7m64Pr7XMdJD4X5m7/BYqFhYIvh0vLsfwOJTaWfcOKWP484EH0ny/m7b3S3Rm EMM7fp2T3K1xIvl0JhVW6MkzMzmWFmSHL9fAdwkm1of3nHkSugomtDwK1R7dBbKebD7K3ua8zdzwm Yf/L1TleO5F/J7P+AXOJm80r/UBc8LHW2bzVoeleI4PVREwS0wgz7cOHKJxagp/KyGnfwWY9Z5Fi1 KyAsGRzKHmDnGdL5KRMAxL8ZZq3cZJ+XRKUQr4LcEjZRasS2kx6ILaGElFcaywgHoqTj5b1pP2FAW 0o4SX+ag==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kd9Io-0007JG-Ri; Thu, 12 Nov 2020 09:54:05 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 921D1301324; Thu, 12 Nov 2020 10:53:58 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 849C72BE31E9C; Thu, 12 Nov 2020 10:53:58 +0100 (CET) Date: Thu, 12 Nov 2020 10:53:58 +0100 From: Peter Zijlstra To: Matthew Wilcox Cc: "Liang, Kan" , Will Deacon , Michael Ellerman , mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, eranian@google.com, ak@linux.intel.com, dave.hansen@intel.com, kirill.shutemov@linux.intel.com, benh@kernel.crashing.org, paulus@samba.org, David Miller , vbabka@suse.cz Subject: Re: [PATCH V9 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE Message-ID: <20201112095358.GU2628@hirez.programming.kicks-ass.net> References: <20201111095750.GS2594@hirez.programming.kicks-ass.net> <20201111112246.GR2651@hirez.programming.kicks-ass.net> <20201111124357.GS2651@hirez.programming.kicks-ass.net> <20201111153022.GT17076@casper.infradead.org> <20201111155724.GE2628@hirez.programming.kicks-ass.net> <20201111163848.GU17076@casper.infradead.org> <20201111172253.GG2628@hirez.programming.kicks-ass.net> <20201111182620.GW17076@casper.infradead.org> <20201111200000.GL2628@hirez.programming.kicks-ass.net> <20201111223344.GX17076@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201111223344.GX17076@casper.infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 11, 2020 at 10:33:44PM +0000, Matthew Wilcox wrote: > On Wed, Nov 11, 2020 at 09:00:00PM +0100, Peter Zijlstra wrote: > > On Wed, Nov 11, 2020 at 06:26:20PM +0000, Matthew Wilcox wrote: > > > On Wed, Nov 11, 2020 at 06:22:53PM +0100, Peter Zijlstra wrote: > > > > On Wed, Nov 11, 2020 at 04:38:48PM +0000, Matthew Wilcox wrote: > > > > > if (pud_leaf(pud)) > > > > > return PUD_SIZE; > > > > > > > > But that doesn't handle non-pagetable aligned hugetlb sizes. Granted, > > > > that's unlikely at the PUD level, but why be inconsistent.. > > > > > > > > So we really want: > > > > > > > > if (p*d_leaf(p*d)) { > > > > if (!'special') { > > > > page = p*d_page(p*d); > > > > if (PageHuge(page)) > > > > return page_size(compound_head(page)); > > > > } > > > > return P*D_SIZE; > > > > } > > > > > > Still doesn't work because pages can be mapped at funny offsets. > > > > Wait, what?! Is there hardware that has unaligned TLB page-sizes? > > No, you can force a 2MB page to be mapped at an address which isn't > 2MB aligned. But not a HugeTLB page; AFAICT mmap() will reject if you try and mmap a hugetlb page out of alignment. So what I wrote above is still valid. If PageHuge() we can be certain it is aligned properly and using a matching hardware page size. You just don't like it because you want me to be purely page-table based.