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 27722C0015E for ; Mon, 17 Jul 2023 13:15:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B39DF8D0001; Mon, 17 Jul 2023 09:15:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AEA3D6B0074; Mon, 17 Jul 2023 09:15:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A00608D0001; Mon, 17 Jul 2023 09:15:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9096B6B0072 for ; Mon, 17 Jul 2023 09:15:25 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4F580160317 for ; Mon, 17 Jul 2023 13:15:25 +0000 (UTC) X-FDA: 81021150210.22.0990CF0 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf16.hostedemail.com (Postfix) with ESMTP id 381DC180029 for ; Mon, 17 Jul 2023 13:15:22 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf16.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689599723; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aNJ8k9Uspo4Tyj3NwE/QcgCwC947zqoXAIWJdkvrO/Q=; b=da8KY9IxcOwCHAOqvrMYz0RHAVSZ8f6I32M8n3f7HAwR1tCq7YCV1zksyiUmRuZWLYen5l Xh/GQhY8aTYeS462sIW9QGquan6Rn0bWDOcoe8UKy0KlfPwxqbuXSYYrhdAiwAzA+arC0c SyOhtw91vvDRxaDeFRCrxtwng+FRbEk= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf16.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689599723; a=rsa-sha256; cv=none; b=nIYRT/zo3KutwBWa4UCLJDmjvJwbeJ8mTN+wVQ+yeEfmLqmzGngzL/p1ckxT+B3gLtMDsb ELyG5YbZRlVXNst0xdruyN/vWn0s/iRfMVgP2FgyMqRgzjF+uWYIuTJoCqHpfN3U0kz27b 6IAuMP0+Wc6Y9mTEV6pYzt3Inj9hL7A= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A4B4DD75; Mon, 17 Jul 2023 06:16:05 -0700 (PDT) Received: from [10.57.76.30] (unknown [10.57.76.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0E9183F67D; Mon, 17 Jul 2023 06:15:19 -0700 (PDT) Message-ID: <7e7145b0-149c-c09d-08a6-99227519df87@arm.com> Date: Mon, 17 Jul 2023 14:15:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v3 2/4] mm: Default implementation of arch_wants_pte_order() To: David Hildenbrand , Andrew Morton , Matthew Wilcox , "Kirill A. Shutemov" , Yin Fengwei , Yu Zhao , Catalin Marinas , Will Deacon , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20230714160407.4142030-1-ryan.roberts@arm.com> <20230714161733.4144503-2-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 381DC180029 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 373p1oghhxp1ke9rjer647uugdk4gms7 X-HE-Tag: 1689599722-909396 X-HE-Meta: U2FsdGVkX18JNYyUEdwquDcuXb5RcsQHvCuxP7SxM/Wm3grTjY13oJA2KAqRFSavwxp8nts4+cwSHZBI/wdrdw/8SjM79Wll82mMO4EDjgj/ivgthVW/sh6WiYrUzieLvjUJzx4NSWkDNcbOaCQZ2WkEG2FajZWbRthD4sHJ+c3nldZoT69lYlKYDlvLidSTTsB9cTj40Sf1tqDFaAhvqXyqQGmrUmDVMXtetuWqQujsX0TA+JfZ/ezrLwzjUe3YUi4/eY03yS1PJNsJ4QqCstla++KN0rBiRv95ctqrNngx7hpoUuhvdwwMB0qjbC1fPaKHj7sLObHuu/hQ14Touhx8zSsgKzy7xDhvNkoTo6LWumNutqF1aCWav3iXwmMYtlAhPxSMfpw41QdJzJj7wUMx39evxlnMs1bSC+QHX8a1xn+hs0XGV2C/zedMMyCc9qay/TLiUB4nYncw8Z03STcUy/8GEMpSYN7AJObVai9K0v/K/IJx527DFmsKyFTArZTKSJxvkUS6NhpwtCgRAQYuoOMeqPEAa4jvjqQuCoazFmjmH7rrOLicdtgeBI2jFbjajW6ucml5i6FCOtokf4kRtjPgXT39zj87grqRanK/X5BzYy1xS9LGL4Qki+Apd+P9blAFf2Aav6fE7ce/lIiKAY062Wt+u7YVsj55m/eigyV89CfDZaOlEkf9ebVue4K1NIQD6RIyfdEHcSAPjJF6N4Gi9ZGWGXIK2ystjjwr17y3deMAhspC6pHZycpXmGWlqER37KhfHPzxcVoq06U6EZ5P3mOwKNe0KbovZF3aSgs3tKa3DoDS8/hgmqsyzclpEtuPjFWpHuIRq8D7VZIfHgRZPan/1LQ1epZYHFtsDbCHllw98LrsSK2SApTEy1uLU8mtM9DukbqO7VgB59Q5vypoqd7hYpBMMMhSFy9qEuslVE7KhwkHqVgQanGfmpifakiln4HxstquaIb 10T6Zj37 KbTYrPt7sRG0AihwPgVM58jJk3Vxuj5gMltRlNbsY5eCmwJZ3vkJnSY7n8CvKe7GNxWR1OdyqV5CsXvYdi+iek2jIu5Z5P0IA+2SbONujkWVFs+XHH+YVCcGqPm2pkI3HwknpyUroeO93cokKWl6lVoT9McsdbO4P+cPNk7JOZxtLuepkPq5bm+64p9kDFcmmrPj092+sCGm8vaZpKPdxX337mA== 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/07/2023 14:01, David Hildenbrand wrote: > On 14.07.23 18:17, Ryan Roberts wrote: >> arch_wants_pte_order() can be overridden by the arch to return the >> preferred folio order for pte-mapped memory. This is useful as some >> architectures (e.g. arm64) can coalesce TLB entries when the physical >> memory is suitably contiguous. >> >> The first user for this hint will be FLEXIBLE_THP, which aims to >> allocate large folios for anonymous memory to reduce page faults and >> other per-page operation costs. >> >> Here we add the default implementation of the function, used when the >> architecture does not define it, which returns -1, implying that the HW >> has no preference. In this case, mm will choose it's own default order. >> >> Signed-off-by: Ryan Roberts >> --- >>   include/linux/pgtable.h | 13 +++++++++++++ >>   1 file changed, 13 insertions(+) >> >> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h >> index 5063b482e34f..2a1d83775837 100644 >> --- a/include/linux/pgtable.h >> +++ b/include/linux/pgtable.h >> @@ -313,6 +313,19 @@ static inline bool arch_has_hw_pte_young(void) >>   } >>   #endif >>   +#ifndef arch_wants_pte_order >> +/* >> + * Returns preferred folio order for pte-mapped memory. Must be in range [0, >> + * PMD_SHIFT-PAGE_SHIFT) and must not be order-1 since THP requires large folios >> + * to be at least order-2. Negative value implies that the HW has no preference >> + * and mm will choose it's own default order. >> + */ >> +static inline int arch_wants_pte_order(void) >> +{ >> +    return -1; >> +} >> +#endif >> + >>   #ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR >>   static inline pte_t ptep_get_and_clear(struct mm_struct *mm, >>                          unsigned long address, > > What is the reason to have this into a separate patch? That should simply be > squashed into the actual user -- patch #3. There was a lot more in this at v1 IIRC, so made more sense as standalone. I agree it can be squashed into the next patch now. Will do for next version. >