From patchwork Tue Oct 8 13:23:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 833574 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp289591wrv; Tue, 8 Oct 2024 06:26:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXZpXpF9m7w1/UwhDJ9hxZal2AA0nY1MhhWMA7txnUNYGaZJwjBUTBo1TDH1BSaTeHFHN6FVA==@linaro.org X-Google-Smtp-Source: AGHT+IH5IIrk6P3B5fABdpH69gPVBc2femzNBQoTdQaZpg5Ohfo2XgI9xhyiH3xofaX26DOBKXwH X-Received: by 2002:a05:620a:269f:b0:7af:c856:820 with SMTP id af79cd13be357-7afc856087amr272541085a.46.1728393972173; Tue, 08 Oct 2024 06:26:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1728393972; cv=pass; d=google.com; s=arc-20240605; b=l1DcjewnJRskvLXB2lUOaqhGgpYFaGNChfJv4aYfWWJljCMCIexKlw8xSNegjdvfwH eQ2azU1zJjTGGuyAu/kAYeG20rcg+IZf67vM1W6abceknx8Q0ZdOz/d2dHymy9KrFltx sILKhx3b11N6XUPx04DscpKeW6xzPcpN4mYLRrgraPrQGXxM432W1ehQoNeOPhV0jTma +4Ms13P75/IbcccRCxYeWl8V5uh8n5autaKc8sEiPCYj3cAexTWROy+lIEEZJJ27ORgc K/2lsCclErwC2cZNNbkmbGOKH+KxWCbmwOt2WywEmC/2iJX7QiRVJDAEPGC8YzaE8tgA +Gaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=UFOWrTvUvTPPO3aHRMJ7fQ/rfyXcYKEKa79Bp/GFXCQ=; fh=dHLBnA+MhGtNtN2B2JMAELi4oD+gmgMg7DL8H0jYbkI=; b=fwRscY62vSgn5WREwagxJy+4BkOA8AAukDj/e7LrKal/lGEdjsgaq01pAgxPGoYyJI Qe2lt8SVU58erqiuzNeT6itM6jDXuB3F3Y1OYvQUxMHoBTIVTyMRYZO2EGm6if6wQfJw xltLDryatLa9tzHcJUpwNOslBIz+kV7MHnJPsm2LBECgrkKtpVpKyOBbWehm5zpIrTsM nCzDEgZAwEpimwsF937lRedhJ3DNeSXMOyxzrvyQu+MHpu+vIR7/kPn4smilEOgZebRl SDsc5vGgwUgiY1HpaM8NZJ4SDDudvzZnR8i6RTgjF0LaatMula5ZFlbACnsq8dulUV7Y 183A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S4pX7b6C; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id af79cd13be357-7ae756628f1si810559585a.270.2024.10.08.06.26.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 06:26:12 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S4pX7b6C; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BEFF53861947 for ; Tue, 8 Oct 2024 13:26:11 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id F1F763861839 for ; Tue, 8 Oct 2024 13:24:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F1F763861839 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F1F763861839 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1030 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728393896; cv=none; b=HfQ+XzOnUXZyMeiLbXQ+yaQB7T7KSmDXILAG3auwjissV+0qhF+aCI2sY3oCN3dbQ3bBdfUofKfsXea422CF/IFlwujy/zAmoGjceXC8N27hLk99RnPDDDIpnmLfl1KtfkYDd/HzsFbV6NsEKZhEcohOmEjAkKkpOJVp+uAkDMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728393896; c=relaxed/simple; bh=fgd82q6X0bInuvp1Bk+vVjE/3khMSRLm1PG8fKgdTFg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=MeCaw2Zn0mYHVkbAM6xKsV1HDVN7Yd1gGOfAKe6AZ62Z90E8MOdtp0ou9u38qdwFcrFKJHf4u1qEL+B1dYmoMdaLgyd1HF1mXjHD8fBDx/P00HK5LyE6Bglh51GzzxHUKa6+Qh07H1A0AsJBa/rr1J3niONvelzzPIuDBULkVUM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2e2916a92ffso274109a91.1 for ; Tue, 08 Oct 2024 06:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728393893; x=1728998693; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UFOWrTvUvTPPO3aHRMJ7fQ/rfyXcYKEKa79Bp/GFXCQ=; b=S4pX7b6CZeS0elHcMcTRJjD2vXReURvBSf69fyQlG00+7x4XIfSMwvY72PfAEBmTaR lXJrZ0SH5sp4ApXAvPStAtXTzT/kC1M7Pa9Tqg4AJC4cWqvmeYKuzy53I8lLzzX8MUR7 kykS7+Zd9uuZyBZ+RMoxL6fCA2vj4WNhgjSoicupfp5pFADsk0YfaVvJAQMqJeH1rACO Y2cBiwRnhysSv5SSXN+u4rW1o9iYbWxsU49ybDYvR6qlOVtgTeGtPgEL/u4ARN9thz8K 2ruwAuPSftSfmCzLvCR8+w9GJFx5t+BH1ADN32vbPgP3FfIL+LlcFyw4W+azIJ4BrUaC L0Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728393893; x=1728998693; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UFOWrTvUvTPPO3aHRMJ7fQ/rfyXcYKEKa79Bp/GFXCQ=; b=hi1z0vYroUAmtAs55oo/pLvcuqCasG++q00Yv1q/vmphab3p+x5SMS3wJ4Q4l9mn7A KsvuVWKeOM2PjgnokMb698hbc3nPohc4yuwGn7varWY1VNvb2RN4YTTaYIMWZfU+yiXZ Don76UlBG3P87+ALlvmiZBtjqD1zELw/LkEowqPJRXevMUrKzHlX5ig3egOkmVFUEVi0 vGbNh7Hra/D+2vViH/QAZVA/B3K4LlfHb0qvc65HnPDfIqrDz66HQ7ZSQemjfgO86/c7 uB01MWzjdKteJ7rodZzuHlsw+APebXufSm6gSISl1DNMrPTodMu/mu0vaiBd1lMbyPsJ ZHaw== X-Gm-Message-State: AOJu0YyZBcTP7AZ6McEuXnQ5pyeJBq3mlTvFyS+KhxaNyuFmWrtlWpLl oibHiiE8fI01bnBHqCkoLPO74IXaoAnhNS2zxujlVvXBkXV3Y5qseBsndfcW7hLCwErsr6SxfSf ezp6coA== X-Received: by 2002:a17:90a:c287:b0:2d8:7edb:fd2 with SMTP id 98e67ed59e1d1-2e1e6267484mr17993845a91.22.1728393892663; Tue, 08 Oct 2024 06:24:52 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:68d6:61bb:ff14:bcb3:8ace]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e20ae7177esm7597909a91.3.2024.10.08.06.24.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 06:24:52 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 6/6] linux: Add MAP_DROPPABLE from Linux 6.11 Date: Tue, 8 Oct 2024 10:23:46 -0300 Message-ID: <20241008132440.722309-7-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241008132440.722309-1-adhemerval.zanella@linaro.org> References: <20241008132440.722309-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patch=linaro.org@sourceware.org This request the page to be never written out to swap, it will be zeroed under memory pressure (so kernel can just drop the page), it is inherited by fork, it is not counted against @code{mlock} budget, and if there is no enough memory to service a page faults there is no fatal error (so not signal is sent). Tested with build-many-glibcs.py. --- manual/llio.texi | 9 +++++++++ sysdeps/unix/sysv/linux/bits/mman-linux.h | 1 + 2 files changed, 10 insertions(+) diff --git a/manual/llio.texi b/manual/llio.texi index a035c3e20f..c8e6e07ea0 100644 --- a/manual/llio.texi +++ b/manual/llio.texi @@ -1762,6 +1762,15 @@ write dirty metadata out whenever dirty data is written out. Unlike most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE} is also given. +@item MAP_DROPPABLE +This request the page to be never written out to swap, it will be zeroed +under memory pressure (so kernel can just drop the page), it is inherited +by fork, it is not counted against @code{mlock} budget, and if there is +no enough memory to service a page faults there is no fatal error (so not +signal is sent). + +The @code{MAP_DROPPABLE} flag is specific to Linux. + @end vtable @code{mmap} returns the address of the new mapping, or diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h index 522333c50a..161a885096 100644 --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h @@ -43,6 +43,7 @@ #define MAP_PRIVATE 0x02 /* Changes are private. */ #define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate extension flags. */ +#define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */ #define MAP_TYPE 0x0f /* Mask for type of mapping. */ /* Other flags. */