From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 5FABE30BB94; Mon, 1 Dec 2025 13:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764595675; cv=none; b=RvRUqNv7MtJ3akwKjIN4C1c3G5FHUpP79n6H36JdO7sEw4oh86V/Zt6w0JeDoTkZzxwbyeZ04x9XIhHoby/N7S8ElULtQRBjTiLeZvwfLeczK9k8tYCc0j+3dRC18ABddhNsB/Xjk9jEN9c+SjvaI+WvozOUDQUrHFjgotHtCBk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764595675; c=relaxed/simple; bh=2V0UxAPSmSzPXqeu8r2/E67WbJoFIbj7Lzk58SCmBkA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JLzTudyu6xZM/Q7sUVKtWCoyx8kCZRWqIkcpml7GpPHiqErHy0Cva51UnZzYDF+PJNyxscaThQxkVKk+0UMpOr8EVpfjFaHJ9BnvS9eGQyRdTQiZjW7Nk9zl0KwnKjC0nZz1qBiy0FlEOPBZPFWXBTFeTdiPBUZ/yF8OoSav7GA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=T9l4N5HL; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="T9l4N5HL" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=0SaEHpLgPQWDg/1suaX25LTMCjnE+f1eGygaTvce+bc=; b=T9l4N5HLxjxjguG4+xviCO4s3B FLkJ4toDbnJQsMpkA821HVAMJww1WQ1ckNVYFRgrbrysOjyrftAMbVjZ76ckiwwMFsSWsgB6QX3bH C9KPEPeAmie7IGXskDbwv8+4gyQsv3f1KF5NXVSSa/FQ4dEQYeQnD1OdyxxDL12tz+hLfS2CcAmsO 2LzyqIdCz+5Ghd7fGvs0/JpXOriFtzi5TxV+Xdj74HJBvZnVXHa5Wofnldywwwvu08+peC9JpTVqS MaCqXen8cNLjejSVp7p2SVG1YADH6RCExxXYnYcZn3evk3uuMnuO3j0/oM6DouJK6udtzey1XMUbZ MTmwFtrQ==; Received: from [189.7.87.198] (helo=[192.168.0.4]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1vQ3vu-007OVO-IP; Mon, 01 Dec 2025 14:27:14 +0100 Message-ID: Date: Mon, 1 Dec 2025 10:27:02 -0300 Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 10/10] Documentation/gpu/drm-mm: Add THP paragraph to GEM mapping section To: =?UTF-8?Q?Lo=C3=AFc_Molinari?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Boris Brezillon , Rob Herring , Steven Price , Liviu Dudau , Melissa Wen , Hugh Dickins , Baolin Wang , Andrew Morton , Al Viro , =?UTF-8?Q?Miko=C5=82aj_Wasiak?= , Christian Brauner , Nitin Gote , Andi Shyti , Jonathan Corbet , Christopher Healy , Matthew Wilcox , Bagas Sanjaya Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, kernel@collabora.com References: <20251128185252.3092-1-loic.molinari@collabora.com> <20251128185252.3092-11-loic.molinari@collabora.com> From: =?UTF-8?Q?Ma=C3=ADra_Canal?= Content-Language: en-US In-Reply-To: <20251128185252.3092-11-loic.molinari@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Loïc, On 28/11/25 15:52, Loïc Molinari wrote: > Add a paragraph to the GEM objects mapping section explaining how > transparent huge pages are handled by GEM. > > v4: > - fix wording after huge_pages handler removal > > v6: > - fix wording after map_pages handler removal > > Signed-off-by: Loïc Molinari > Reviewed-by: Bagas Sanjaya > --- > Documentation/gpu/drm-mm.rst | 22 +++++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/Documentation/gpu/drm-mm.rst b/Documentation/gpu/drm-mm.rst > index d55751cad67c..d69eab0b4093 100644 > --- a/Documentation/gpu/drm-mm.rst > +++ b/Documentation/gpu/drm-mm.rst > @@ -290,15 +290,27 @@ The open and close operations must update the GEM object reference > count. Drivers can use the drm_gem_vm_open() and drm_gem_vm_close() helper > functions directly as open and close handlers. > > -The fault operation handler is responsible for mapping individual pages > -to userspace when a page fault occurs. Depending on the memory > -allocation scheme, drivers can allocate pages at fault time, or can > -decide to allocate memory for the GEM object at the time the object is > -created. > +The fault operation handler is responsible for mapping pages to > +userspace when a page fault occurs. Depending on the memory allocation > +scheme, drivers can allocate pages at fault time, or can decide to > +allocate memory for the GEM object at the time the object is created. > > Drivers that want to map the GEM object upfront instead of handling page > faults can implement their own mmap file operation handler. > > +In order to reduce page table overhead, if the internal shmem mountpoint > +"shm_mnt" is configured to use transparent huge pages (for builds with > +CONFIG_TRANSPARENT_HUGEPAGE enabled) and if the shmem backing store > +managed to allocate a huge page for a faulty address, the fault handler > +will first attempt to insert that huge page into the VMA before falling > +back to individual page insertion. mmap() user address alignment for GEM > +objects is handled by providing a custom get_unmapped_area file > +operation which forwards to the shmem backing store. For most drivers, > +which don't create a huge mountpoint by default or through a module > +parameter, transparent huge pages can be enabled by either setting the > +"transparent_hugepage_shmem" kernel parameter or the > +"/sys/kernel/mm/transparent_hugepage/shmem_enabled" sysfs knob. It would be nice to have a paragraph about the use of the huge tmpfs mountpoint helpers (maybe in the "GEM Objects Creation" section?). Best Regards, - Maíra > + > For platforms without MMU the GEM core provides a helper method > drm_gem_dma_get_unmapped_area(). The mmap() routines will call this to get a > proposed address for the mapping.