From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30C53AD59 for ; Wed, 17 Jul 2024 10:26:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721211964; cv=none; b=lsyAVpdPqpl7LqPTGCoHk12Vr4ZKF875JYNc7U+CLYmH9OWtDCGTdQjkWq2IOB9vqidXrBFUTEs284UZpbO70arX+J6+S48NF+qZV46iXMxsmiuzb6MGF7Roh30eyWWNrXFe+PBuE4lE/FINtAqil+OnSWxfo0/68pZ4U2S/UKA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721211964; c=relaxed/simple; bh=dzLzs5Ufg5cKPdFHu0FjflI8vo8yY+ppR/S6GfDwLO0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qwF55SDD6EMccRvvvx0QhRvv1crumwoD+CSPkwcPRfog7Cl4UBOUzOf0wVytWGrcfvhEW0c9e0Od2DLVEGgKWAXreCGx8dLiF2bJttSbKi016Yx/pCuJtCPRdOHv99Rw3tHaC3RouSOGmMg1wy6Vez4YRYuYRu/jjJhsEcYHNkE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LELLLTdZ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LELLLTdZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721211961; 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:autocrypt:autocrypt; bh=fe+Z8Gp+acB5PZFnSJ1mOiAILiyFLtmBYAchEJflP04=; b=LELLLTdZfGNhi+KHWrl1QJ0+s3QIaOuBJnkJ3Ch485s3qHnLra5Kv3QwAssjBxqPl5m1Tk k04tHvBcXCnGJqy3H4QWd8aPCzQ87UUiVJS13zwT84YcEOC1kmbeyjnMShDA0uV1l2bEhE rAz6AGglxMg5WjALOpdlfO7MKx6iF4s= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-_DW-_e5LPyWR0-J4O2_COA-1; Wed, 17 Jul 2024 06:26:00 -0400 X-MC-Unique: _DW-_e5LPyWR0-J4O2_COA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4266edc9c85so49743725e9.2 for ; Wed, 17 Jul 2024 03:25:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721211959; x=1721816759; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fe+Z8Gp+acB5PZFnSJ1mOiAILiyFLtmBYAchEJflP04=; b=ECgH4Tn6i3Aa+Qn5BjQN4AgzeaSlB81qY4pGPQZBEZ+rQEz4Fxax1wPWLazU45r8sL Rzdzy4WIVbgFmGSzNqWPh5Lc6v0GZTGc7NhyFdlzzZjf8Yh8Sk3b18eyReK9UCIlCXc3 zgb/VEpCLPAJuBSG1A/Zw9NnhdUnJlHuoP6p7UDEneB4LzYiXWoSZMz1eQAS9sPK7YrK acDjI2zDTbtlRRTvCQNWZapOjm1Hm1ZRinuAYNbu7XQSTOlNX+DyA/JZyhB7UfC/ldt2 EdtHym/trxgwUF4TxbfPSogt9ci7JPsAy53TqKFEtx+37oEJsx8JMym9LlaiACyNV+0t W0UQ== X-Forwarded-Encrypted: i=1; AJvYcCXR8WwtDx3M9XKtecu+vJ1cJVS4FePJrr+tMoU9DOocfO/Pr5wP3odgQgKLOeJlggN7EWNc9L++Vq3hT9U3MjAApf4BKqa1KrNOKav2 X-Gm-Message-State: AOJu0Ywu1zrwfXWkyT5SXIg+vgDd8GBwHkNYSGpEjstIb4Ur7TP+ZSP9 hYjo7Krgx5IvbC+9sA0N+0yv6XRE0wFzRsvIwNmk6hZdZYkm21hZt0nzFItZ099E/VPc2F2Pkce UKbinGWFIs7dTBe+CLfydy88eTLtJf0c30TdeXnsEdan2CUUHguWr1JCgTdRsJA== X-Received: by 2002:a05:600c:4fd4:b0:426:5dd0:a1fb with SMTP id 5b1f17b1804b1-427c2caa7c0mr8077345e9.7.1721211958813; Wed, 17 Jul 2024 03:25:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6Wo1JG3K5nLtB6xg62B4lE9gmXlLtyNJokTWCjpdsf8VdbhfaGOesqz98imyCmmLtepzjLA== X-Received: by 2002:a05:600c:4fd4:b0:426:5dd0:a1fb with SMTP id 5b1f17b1804b1-427c2caa7c0mr8077135e9.7.1721211958354; Wed, 17 Jul 2024 03:25:58 -0700 (PDT) Received: from ?IPV6:2003:cb:c714:c00:b08b:a871:ce99:dfde? (p200300cbc7140c00b08ba871ce99dfde.dip0.t-ipconnect.de. [2003:cb:c714:c00:b08b:a871:ce99:dfde]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4279f2cc244sm197463605e9.37.2024.07.17.03.25.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Jul 2024 03:25:57 -0700 (PDT) Message-ID: Date: Wed, 17 Jul 2024 12:25:56 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 2/2] mm: mTHP stats for pagecache folio allocations To: Ryan Roberts , Lance Yang , Baolin Wang Cc: Andrew Morton , Hugh Dickins , Jonathan Corbet , "Matthew Wilcox (Oracle)" , Barry Song , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20240711072929.3590000-1-ryan.roberts@arm.com> <20240711072929.3590000-3-ryan.roberts@arm.com> <9e0d84e5-2319-4425-9760-2c6bb23fc390@linux.alibaba.com> <756c359e-bb8f-481e-a33f-163c729afa31@redhat.com> <8c32a2fc-252d-406b-9fec-ce5bab0829df@arm.com> <5c58d9ea-8490-4ae6-b7bf-be816dab3356@redhat.com> <9052f430-2c5a-4d9d-b54c-bd093b797702@redhat.com> <5472faf5-1fbe-4a89-a17e-83716fc00b5a@redhat.com> <41831175-6ea4-4e0b-8588-e51e5ee87f19@arm.com> Content-Language: en-US From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/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foUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <41831175-6ea4-4e0b-8588-e51e5ee87f19@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 17.07.24 12:18, Ryan Roberts wrote: > On 17/07/2024 11:03, David Hildenbrand wrote: >>>>>>> >>>>>>> But today, controls and stats are exposed for: >>>>>>> >>>>>>>      anon: >>>>>>>        min order: 2 >>>>>>>        max order: PMD_ORDER >>>>>>>      anon-shmem: >>>>>>>        min order: 2 >>>>>>>        max order: PMD_ORDER >>>>>>>      tmpfs-shmem: >>>>>>>        min order: PMD_ORDER >>>>>>>        max order: PMD_ORDER >>>>>>>      file: >>>>>>>        min order: Nothing yet (this patch proposes 1) >>>>>>>        max order: Nothing yet (this patch proposes MAX_PAGECACHE_ORDER) >>>>>>> >>>>>>> So I think there is definitely a bug for shmem where the minimum order >>>>>>> control >>>>>>> should be order-1 but its currently order-2. >>>>>> >>>>>> Maybe, did not play with that yet. Likely order-1 will work. (although >>>>>> probably >>>>>> of questionable use :) ) >>>>> >>>>> You might have to expand on why its of "questionable use". I'd assume it has >>>>> the >>>>> same amount of value as using order-1 for regular page cache pages? i.e. half >>>>> the number of objects to manage for the same amount of memory. >>>> >>>> order-1 was recently added for the pagecache to get some device setups running >>>> (IIRC, where we cannot use order-0, because device blocksize > PAGE_SIZE). >>>> >>>> You might be right about "half the number of objects", but likely just going for >>>> order-2, order-3, order-4 ... for shmem might be even better. And simply falling >>>> back to order-0 when you cannot get the larger orders. >>> >>> Sure, but then you're into the territory of baking in policy. Remember that >>> originally I was only interested in 64K but the concensus was to expose all the >>> sizes. Same argument applies to 8K; expose it and let others decide policy. >> >> I don't disagree. The point I'm trying to make is that there was so far there >> was no strong evidence that it is really required. Support for the pagecache had >> a different motivation for these special devices. > > Sure, but there was no clear need for anon mTHP orders other than order-2 and > order-4 (for arm64's HPA and contpte, respectively), but we still chose to > expose all the others. order-2 and order-3 are valuable for AMD EPYC (depending on the generation 16 vs. 32 KiB coalescing). But in general, at least for me, it's easier to argue why larger orders make more sense than very tiny ones. For example, order-5 can be mapped using cont-pte as well and you get roughly half the memory allocation+page fault overhead compared to order-4. order-1 ? No TLB optimization at least on any current HW I know. But I believe we're in violent agreement here :) -- Cheers, David / dhildenb