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 2E87DC369DC for ; Fri, 2 May 2025 01:02:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42E696B009C; Thu, 1 May 2025 21:02:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DC1F6B009D; Thu, 1 May 2025 21:02:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CC746B009E; Thu, 1 May 2025 21:02:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0EF7F6B009C for ; Thu, 1 May 2025 21:02:58 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AC52EC1876 for ; Fri, 2 May 2025 01:02:58 +0000 (UTC) X-FDA: 83396168436.23.21CF7E1 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by imf21.hostedemail.com (Postfix) with ESMTP id 7E0D71C0005 for ; Fri, 2 May 2025 01:02:55 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=fNeRE9nU; spf=pass (imf21.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1746147776; 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=5wOtn7+0eH5S9Osa2VOzYdwINzoQRtielagFITbsLqQ=; b=Jpql10nf2wT44f/dO6LdgeJ61QXHzgGWdZUiEKYDS+LjkvCjm+8o/HByZ+OLCZQs3UBIOM wdY4m7ZnJ3T0Pi5ODrNPUu7cs8ZKWEXpVoBkVKRkHy8T+tfGO51/ogSGiJdcM24mtS7A6j z3HdPtXcWkXQ4vFDOhA5zR4hg/75NAE= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=fNeRE9nU; spf=pass (imf21.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1746147776; a=rsa-sha256; cv=none; b=2/ztntlmx1mxdVJ0yQKGjI5moWc4KnB1xErZp1LYC6MiyVqjvi7D6c2GDOPtwqOlPU7Nhq zl668x2alZ/tT+ZPWo5vrRDE/FwMUC4QEehFBKfCZ52/XlLpl8xV35s+PbcZs9d8ZW6JvC jXzBLDB5K6j6H8jvnFwdPtPOo/tPq3I= DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1746147772; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=5wOtn7+0eH5S9Osa2VOzYdwINzoQRtielagFITbsLqQ=; b=fNeRE9nUs1hI46BwO2txo00v+lHCRLoSUH4B4l+PRoUxhQwGkLxtqIQlSzgiMVVN/c/7nop0SBj2eCv4niWTasLO3jrMktFbVQTE2iNjD9fQVYJTvDdws4ch3F+CtSKli31P7PnOAjvbHWuzpaUKygdtFP8YQ0yPSVSPEVt3wnE= Received: from 30.0.191.233(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WYtQLJQ_1746147769 cluster:ay36) by smtp.aliyun-inc.com; Fri, 02 May 2025 09:02:50 +0800 Message-ID: <57dc4929-268b-4f3f-a0f8-43d6ec85974f@linux.alibaba.com> Date: Fri, 2 May 2025 09:02:46 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [REGRESSION] Re: [PATCH v3 3/6] mm: shmem: add large folio support for tmpfs To: Daniel Gomez , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= Cc: akpm@linux-foundation.org, hughd@google.com, willy@infradead.org, david@redhat.com, wangkefeng.wang@huawei.com, 21cnbao@gmail.com, ryan.roberts@arm.com, ioworker0@gmail.com, da.gomez@samsung.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, regressions@lists.linux.dev, intel-gfx@lists.freedesktop.org, Eero Tamminen References: <035bf55fbdebeff65f5cb2cdb9907b7d632c3228.1732779148.git.baolin.wang@linux.alibaba.com> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7E0D71C0005 X-Stat-Signature: ukgesz9s9zbwd755hm4qnsm3rmdczchp X-HE-Tag: 1746147775-382577 X-HE-Meta: U2FsdGVkX1++UIF2f8Jzyh9fgOIG/B/BHFO1tStFFYy6qsNApndEEfan2pYFDRDiufSI7pwto6glGXpdlVmA6M7wylMs0Tc22TVSKHnMemjTGuvweRR31tJpHJt4bH//ogNVcdZ8bXy27R47mhSDjj8WSJfrR3yFksxClwVxAKdzefbX+O/+OljzwE9QPN2t90qShmRlIQYPfP7HXru7Cm/OTqzBM+bOv8iCZYdYnt71p3uSKD9sjB7ntnwAV2csCVy0o2gam0seFfQnMxZKk8xXZ8sHzAV5q1oLt0vMwPlG0dC1VSjI9b1zrgd3G2k9Vq/ut7E/DMBHva92tYtUysegOeNUptxSgVCn5a5Ss5asM7Isi3UqtnB/HyDJnuDsk+ROXPidb/5zhJYNAC2+MxmwucXUDR351LZzHAUeVgX6YiQ7rr7fcrBPYbwMcHiruWSoe1x4usLRFLJdWgD+lhUvP7iDBu8Dq6Oc+rQ/PnagmGPCOtocTO4coeLZl5G7do2827tg/LeTs2gcmSXSul59MbgSzna4kmNQ79lMCBPC+iEjnhl1tGocKMQZoULagFvxsvwEXsCDreM6a8oyUzSPzpb3I0tEDvLJBCmjZWlMef02L2xMHTJzfrJhkU13EusvPpwMAq/ckO+mDdBvUwy8FxUB3ggs2+zuHlXEbGShzRCpSXl/KKgMKKh/94QpYch/I4HPOXSvs7liLqUTbtKH4ZL077N5ZPlp0jbkMamOlIG3OsZZet0B/qnjE216AIGvvYfYppT8G8M+rQeaOTv9WD3HlwSyq0eKM3grAHyovMxNkHkc6pv84E8zPPgZa67VXtCKnj6XM9wNGQVHhdIAZ0dY80qaQvoxgRvvc7TWfOGXwWlBF4J5TtBjZ/CAd53IkHyF7kI4yURRZtyI8kukXbd5YaXx0Z4nzl+qxlxCtRkZJNRFmxqQ1nuUZEAhjQEJKKNY8RMjSuXvOgz i5V+X4GS tEqCVQBPmLzBIcYU5PTnT4rRfs5IVWoogbc0HM30CFsOUOVIzq9/YGLwSmNZMaad2dVve3wY7RDmvrOYjJdU3dLgCrcA7ZIQsw+yYAXZ+f1/DU1tGLW9R09JCUgbTYvOo0fwqqpTWPNL8Zx8UN+Yc9rR0lx1BhOZ/fP94SwuON/Pcosqrthk7cSBV2CvWn/lBRzE1QezS/SICJfbb8PC6BPqJ7ornz+TcxvIbaImKJabHy+Zs8RvMHbrD7z6XBdWAaGlSyCcx4QBzXJFuY7uL+BEhbw== 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: List-Subscribe: List-Unsubscribe: On 2025/4/30 21:24, Daniel Gomez wrote: > On Wed, Apr 30, 2025 at 02:20:02PM +0100, Ville Syrjälä wrote: >> On Wed, Apr 30, 2025 at 02:32:39PM +0800, Baolin Wang wrote: >>> On 2025/4/30 01:44, Ville Syrjälä wrote: >>>> On Thu, Nov 28, 2024 at 03:40:41PM +0800, Baolin Wang wrote: >>>> Hi, >>>> >>>> This causes a huge regression in Intel iGPU texturing performance. >>> >>> Unfortunately, I don't have such platform to test it. >>> >>>> >>>> I haven't had time to look at this in detail, but presumably the >>>> problem is that we're no longer getting huge pages from our >>>> private tmpfs mount (done in i915_gemfs_init()). >>> >>> IIUC, the i915 driver still limits the maximum write size to PAGE_SIZE >>> in the shmem_pwrite(), >> >> pwrite is just one random way to write to objects, and probably >> not something that's even used by current Mesa. >> >>> which prevents tmpfs from allocating large >>> folios. As mentioned in the comments below, tmpfs like other file >>> systems that support large folios, will allow getting a highest order >>> hint based on the size of the write and fallocate paths, and then will >>> attempt each allowable huge order. >>> >>> Therefore, I think the shmem_pwrite() function should be changed to >>> remove the limitation that the write size cannot exceed PAGE_SIZE. > > To enable mTHP on tmpfs, the necessary knobs must first be enabled in sysfs > as they are not enabled by default IIRC (only THP, PMD level). Ville, I > see i915_gemfs the huge=within_size mount option is passed. Can you confirm > if /sys/kernel/mm/transparent_hugepage/hugepages-*/enabled are also marked as > 'always' when the regression is found? The tmpfs mount will not be controlled by '/sys/kernel/mm/transparent_hugepage/hugepages-*Kb/enabled' (except for the debugging options 'deny' and 'force'). > Even if these are enabled, the possible difference may be that before, i915 was > using PMD pages (THP) always and now mTHP will be used, unless the file size is > as big as the PMD page. I think the always mount option would also try to infer > the size to actually give a proper order folio according to that size. Baolin, > is that correct? Right. > And Ville, can you confirm if what i915 needs is to enable PMD-size allocations > always?