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 7DB33C7115B for ; Wed, 18 Jun 2025 07:46:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 042A96B0088; Wed, 18 Jun 2025 03:46:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F35DE6B0089; Wed, 18 Jun 2025 03:46:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E4B6B6B008A; Wed, 18 Jun 2025 03:46:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D8D0A6B0088 for ; Wed, 18 Jun 2025 03:46:31 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8779580ABD for ; Wed, 18 Jun 2025 07:46:31 +0000 (UTC) X-FDA: 83567738982.09.ECF4387 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf22.hostedemail.com (Postfix) with ESMTP id 56D85C0007 for ; Wed, 18 Jun 2025 07:46:29 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=spoIFwP0; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=PTBsKn5B; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=s69NhA1c; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=hv0GDsGT; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf22.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750232789; a=rsa-sha256; cv=none; b=77N+b9gIKhwU7YiTOWJs56h3Ws4t6wIUEOCO3YxGw4fZLzgpu2e4ejasHWc/9tVgjMkOL9 mH+UiCjgbyiXlo7r2+sTHCqW+Admaoia6iToe35KJGcjmD5lJ14Ah/xXDAo8ilyi5UBbPq 2hZSVrf2CeN0tcQTRJblKEPq2oBX3w0= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=spoIFwP0; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=PTBsKn5B; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=s69NhA1c; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=hv0GDsGT; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf22.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750232789; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RC+O0xj37+Yau58lyiHCV9xUnnOZ5GevJAzczGl/EV8=; b=KszbgN9N0Qfx1ANWEkWwHAmoGa3b1Weqj2eb0IoG1n598bCyYbmvBJqadeQBr6QGPOINRD xXHdUl6rrZ7PSooO6odwUYsKOMNwuMlSZNSchJoTidcPqbmjTeYsWWUrowLtfrC/qLJ82q Qb6vT6et1TEdiRIhg3w3SQZSPeA2txI= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 97D931F7C0; Wed, 18 Jun 2025 07:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1750232787; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RC+O0xj37+Yau58lyiHCV9xUnnOZ5GevJAzczGl/EV8=; b=spoIFwP0GUx0oL/Al3wYDGqO2Ms785XkS3z+TQJ6jYucPcwaVPjL7GjOo64ZcATIBD+kfT vettQ2+exQ8hMdawan7z9kB9eMyq8bBZeuL/JYvO0t4yvOvmuoHDqjN40IJqVYRgowimuw zA2o63JeHpRfsg2mP0h+C9tvSS85rvs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1750232787; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RC+O0xj37+Yau58lyiHCV9xUnnOZ5GevJAzczGl/EV8=; b=PTBsKn5B5HyvpMQk2XrmTVh17ufPR7duKGeKARDw3lXTaTZ40sfz8dzyEtmMGYJld6+2vG WFdjxClXy0CeBZCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1750232786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RC+O0xj37+Yau58lyiHCV9xUnnOZ5GevJAzczGl/EV8=; b=s69NhA1cBtxNb0iqsjM06xlw5uusEuIrC9lwfb6v6PDsyBgvTfQRzXjc3WUL5n6eHwZoaw XNlI21spixT7NESSDYnAASnn8a8440/67d5ytjm1I5j3HWlBVsYxHKj9vggMGQgaU90QkD UjZdGJAIcFpb90vdadg9R6f0omszBPo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1750232786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RC+O0xj37+Yau58lyiHCV9xUnnOZ5GevJAzczGl/EV8=; b=hv0GDsGTEccUveV/7L0i1as+rco4s2pxSfMMMjUPyT6iaPj2hhi4448p6ToqQ5Kg+NrHeS /vJWkexH+MqvotDg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1EA5F13A3F; Wed, 18 Jun 2025 07:46:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uVqkBNJuUmjdewAAD6G6ig (envelope-from ); Wed, 18 Jun 2025 07:46:26 +0000 Date: Wed, 18 Jun 2025 09:46:20 +0200 From: Oscar Salvador To: Vivek Kasireddy Cc: dri-devel@lists.freedesktop.org, linux-mm@kvack.org, Steve Sistare , Muchun Song , David Hildenbrand , Andrew Morton Subject: Re: [PATCH v4 2/3] mm/memfd: Reserve hugetlb folios before allocation Message-ID: References: <20250618053415.1036185-1-vivek.kasireddy@intel.com> <20250618053415.1036185-3-vivek.kasireddy@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250618053415.1036185-3-vivek.kasireddy@intel.com> X-Rspam-User: X-Rspamd-Queue-Id: 56D85C0007 X-Rspamd-Server: rspam02 X-Stat-Signature: p8jaeouorbq4wiiggr94ja5hf87d6eqs X-HE-Tag: 1750232789-672670 X-HE-Meta: U2FsdGVkX1/FkhgUX4mn9BuJj9Wegqe9jIK1Mn/qOJm/TuuAdsJe9u1FKR5iZIQH66L136ky+08kPkCUUXFBLzwZrGvxQw1EdeN3ipzzPRCpEe3PEOlazNTpOL2rTuOFuDCZRPxEO6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ohrlc/pL/WzkdfgRjXHxNTU5crCC3n6Fnd+mmPk= 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 Tue, Jun 17, 2025 at 10:30:54PM -0700, Vivek Kasireddy wrote: > When we try to allocate a folio via alloc_hugetlb_folio_reserve(), > we need to ensure that there is an active reservation associated > with the allocation. Otherwise, our allocation request would fail > if there are no active reservations made at that moment against any > other allocations. This is because alloc_hugetlb_folio_reserve() > checks h->resv_huge_pages before proceeding with the allocation. > > Therefore, to address this issue, we just need to make a reservation > (by calling hugetlb_reserve_pages()) before we try to allocate the > folio. This will also ensure that proper region/subpool accounting is > done associated with our allocation. I'm not really familiar with memfd code, but can't you make such reservation when you create the file in alloc_file? I see that you explicitly pass VM_NORESERVE. What's the reason for that? -- Oscar Salvador SUSE Labs