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 E3A63C001B0 for ; Mon, 17 Jul 2023 13:04:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5238C6B0072; Mon, 17 Jul 2023 09:04:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D4998D0002; Mon, 17 Jul 2023 09:04:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39BA48D0001; Mon, 17 Jul 2023 09:04:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2BC936B0072 for ; Mon, 17 Jul 2023 09:04:18 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B65A0160317 for ; Mon, 17 Jul 2023 13:04:17 +0000 (UTC) X-FDA: 81021122154.21.6B9DE22 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id EA89610019B for ; Mon, 17 Jul 2023 13:01:30 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=isO9kKKu; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689598891; 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:dkim-signature; bh=9n0zHXcSDacvhFMCDGyf2nvIVwtaHD3xGEh2ddwFlZ8=; b=ZLoytHPepZrAnHRtFXJv/EcgUh4o6sLbXemE44eON127yIvoywAngNEkxdjG+M61aBfzPe 3JnPuLGb8BqcXGt0l4wq6UGEE4UYAbSanKW3sPfLGk1W3WeOrP/VE9EnehTTKehjDNiybB f0rtYHmFtUguypyzk3BFQ9hP7N5UA+s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689598891; a=rsa-sha256; cv=none; b=Ap1v6XVC/nfdRMIoT1EJo3snly5e9g4xFW3MySGq+1Ni1rXV9cszAo0KYyA1l7Tzn/DtnW 3ZK4Yb/Tjn/nKZoF7OdPJUlzDqXTiE/gPkw4KbYb3kuCO9UsCgkXOQBYFUTycwPmvQKFOW KfdVp4OKhCRmrh9e7cZARftLiZSAliQ= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=isO9kKKu; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689598889; 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=9n0zHXcSDacvhFMCDGyf2nvIVwtaHD3xGEh2ddwFlZ8=; b=isO9kKKuVdgS+PmLj8kn8t+lQR7dqNevD0B9BdECl5igBoDfzKNj9wwLZo/mWUC8V8uAtl wmCimWYP+zUrdfpIoFtuU3g7G7ShllK2T2ON3jbN9vGLl/j1rXUqesPke13nC47unIrf09 qvtmVsg0PKqRf8sCh5hOa/wI1cACIyU= 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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-M61K9fmEO6y1IwHdsdy_Pg-1; Mon, 17 Jul 2023 09:01:28 -0400 X-MC-Unique: M61K9fmEO6y1IwHdsdy_Pg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-30e3ee8a42eso2560016f8f.1 for ; Mon, 17 Jul 2023 06:01:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689598886; x=1692190886; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9n0zHXcSDacvhFMCDGyf2nvIVwtaHD3xGEh2ddwFlZ8=; b=SAf86srKWdjLZsF3d1WRzCWeVt2tLfeGG5tPmR+yZ0kHP1s7EfBy4ukUeIJ2Jy04wg pQuGh3/EAWhrRhOUPwtjzMDBainlR9LnaLLdja/lMvWAFac7S3Ioq560ihv7Z3/1/DnR zx7NwKprHGxuh6Z46Go34fAE2KRWMA8GHKmYHeGYUECOul8GLOJTwjBxRnrNJjB/EZS9 e7xq+yLHd+Ix/Zmn1FFGj4grC6YSYvOrJ+Yx+cIfnlq/i+xc8kIIkWnIbV+am7qWupv5 an812aVrv4e4R7cqzti1qD6F0+gHTulRvVZnG2+ZJ+iT+DwzpsjgNIf+HvFKxBaKNd4d ylTw== X-Gm-Message-State: ABy/qLbPpqDIPmhFJxalOjwRVlSPGE/Tu9o7kc/pTb5f5RDzjAyWy8a5 8tlrR8HeDMkOuMbS7EETHaqNtq8lDAeC2o76wdwUr3W2JYmLtyrsMneA81m7UwN8/FVFgRn9AvX spdZDxBWhg8w= X-Received: by 2002:a5d:5045:0:b0:314:10d8:b483 with SMTP id h5-20020a5d5045000000b0031410d8b483mr9678919wrt.64.1689598886553; Mon, 17 Jul 2023 06:01:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlE9rIUmQGqf7bxO4VT/69gTxxlwrzU6+KE5VRwg9EdtWBnPKwpFjgu5dBwr/K3plrWNFF8nrA== X-Received: by 2002:a5d:5045:0:b0:314:10d8:b483 with SMTP id h5-20020a5d5045000000b0031410d8b483mr9678874wrt.64.1689598885978; Mon, 17 Jul 2023 06:01:25 -0700 (PDT) Received: from ?IPV6:2003:cb:c735:400:2501:5a2e:13c6:88da? (p200300cbc735040025015a2e13c688da.dip0.t-ipconnect.de. [2003:cb:c735:400:2501:5a2e:13c6:88da]) by smtp.gmail.com with ESMTPSA id x14-20020a5d490e000000b0031423a8f4f7sm19139030wrq.56.2023.07.17.06.01.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Jul 2023 06:01:25 -0700 (PDT) Message-ID: Date: Mon, 17 Jul 2023 15:01:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v3 2/4] mm: Default implementation of arch_wants_pte_order() To: Ryan Roberts , 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: David Hildenbrand Organization: Red Hat In-Reply-To: <20230714161733.4144503-2-ryan.roberts@arm.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Stat-Signature: zkbkyp9bxdh6wg179psp6ne4p1iy1ci1 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: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pytj6DMM4h8338xht9thdCwXsocYeAc8ukz03vVfhb70WJX1Bfc8mgVtnFiaVPsR7nvBIVme5qWJLY6di5eiUwagOWrlCzj6ps4NmDMS6jBM+qsAiKaGwq2YqoS/0zrCiKMtsQ5kgV4keqJGNGebx9kN70nYneCNQ+YgDtFHw1cFXmHKhMohJlZhsFlTKjt2j8DuD2iHZUQNqBdf6CXQ/PBm7jIT82+CHAfP3DSyU5xF6FW+0sW6r6ridnSntiAJVoltwM2JYArVGzhRSFTrJ+lOR3QDD6B/ratSw8WaXbL0JJhLyidnCFjmHfesPrFlqMksFABPfm/XFEHOjECI7jFPJAql64= 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 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. -- Cheers, David / dhildenb