Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vhnjN-006PCW-0W for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Jan 2026 11:47:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vhnjL-00D3WP-1A for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Jan 2026 11:47:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vhnjL-00D3WH-0D for pgsql-hackers@lists.postgresql.org; Mon, 19 Jan 2026 11:47:35 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vhnjH-001EYa-2m for pgsql-hackers@lists.postgresql.org; Mon, 19 Jan 2026 11:47:33 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-59b72a1e2f0so4669138e87.0 for ; Mon, 19 Jan 2026 03:47:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1768823251; cv=none; d=google.com; s=arc-20240605; b=MH+lTTx5dIgu7fZvpb0NSHuFhzXWIfdo+OZRebrVRZtC33LfTUwU+/hpaPCIH5tg6B sE45ilfUieLyaFiwxnDH1BIC76gsrEt57FmCD7IQJvXoD6aGfZdkmHeufn1ZZlWw22YY xga24Vc9eLTivGdGBkDDftcPmixH6y9OD0vnt7V0yefyIICad80dVlKptEwvp01QHdps fWUsPvHjJsKfKTShfSZJSKkBerkcL0Uk5ZNdGz60uEi92vneFJqgxltcwIijJ1Jg1Bjh CFB83YYoA3NSut4yhlZwYs6N64ly6QEes96PhckPSndDQbB+j+ezOKc5XRIdTNk1kGou OVqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+gN7wLM/B0pL9zKQaXl3y6saL1xWF8lPTigk+rWODec=; fh=q6rIO9gnAT6j+EnDyW4ENfUv/glLL82tUnO8wmr1CJc=; b=fDg8IxKbbyU3ghBbRHwIscvKWS8lw4Qv3i4Dwi31lE4Oq60II9fXbWx9qcftpndwwz 9I3wPCvZp4XAF9IeDX2iDp90WBIzwnVhLq+C8/X2hHCQYNGQAwwzJp6doS/Ja8p+qlBW zEj3lrBfuqaa0tQqQQQQ4xaGp/JWTOOQGMv9irFLgSPX/cK+Q2HySJ8IIKnbmwTorC49 Cv0fnPPVKeY0vFWJHpfNmCKz9BcntzVQvHOqBGwUEyZfMrBGoFuXQmf8MqOmH17pSj6t nacV5qtnFSAUarhhPhROYYFGnkrW302zmQkIIPDEHIRESBiF0FfCWISSyqSJsOePvYs5 TG3Q==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1768823251; x=1769428051; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+gN7wLM/B0pL9zKQaXl3y6saL1xWF8lPTigk+rWODec=; b=dWAzA1wGKMy3ZaRG3aJRycMNQWL7rowtltKfQCIKJyIxukh8stOBkU7/C1v1t+nwkJ GvxpPFBYOcHLx9gx+j4HLzSRvQ8+KsqnsnyqrDVKNqkeyaNpMA3IQfxGPCxBNPPcMoMA TsP1elS7ptlIptGnSgXdI2jdSvYF+QaNHNZ2m0Q59d6qYoZUqAe3S16BmsYRsOgZIO8l 9sJ5wD1i7VQZY14OYdskVNXCn+m0p9f7hgxyEJoZJryqXkU4IKfNSj8DTr1jMB7qlGHk 8Cr0/CWWGgtfx0v5E+Fsy3rI75SaJuEMGsz/L6bkI5xK6YchN/6kdpTh2DUZv/P7CIbU 6DDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768823251; x=1769428051; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+gN7wLM/B0pL9zKQaXl3y6saL1xWF8lPTigk+rWODec=; b=gV3ri0Gskkwjj+zbegLzWaGnkOl1h5hMrBpXSpMRSiSvh1McxYSiUlqzhPPVeFHvo+ 2xnmIBS++EABPNP/ZIUSPjEeOLMG1SGAoXDWm+e+5ko5A8mDfG5y7FZx61+Blu/OjKup LkC1WsNeN6pxQgnvwRObZZcTWjm2uaPvGdGTQOnzOM4O8EgcSXGJ25OArtsAvkft+DYy W8EZ70cHf28yF0VeTJZiPoODxaob+qHuOJcaXTKFvN2ScEs5rHpKdBZarl17lFCoInie B/HxeMef5Zeh/bKc2FiXdhN+N9GOVCtRrgNcqpjWvaVat3m0gLFdT1qUkT9MaG13xTPm ibug== X-Forwarded-Encrypted: i=1; AJvYcCUe0Q0feYSCGF6F/uFdINIGF83nLJZoV52kILkp+uIiTuBpLHoHIie38aF8/pVpzHD3A7QXr5F5LVIT0Wyo@lists.postgresql.org X-Gm-Message-State: AOJu0YzsTzihnXOizEtxfmnZ9hhFIL54Jmfw3Nit98sXdjrf32R64QWq OTwpWaYNe5VuyoDfLEGHJKTfLp5FXTKh8MWRjRqwihZuMBm3OmnifzPahTPeARRod6960TcjB6C FwgZGqkiJh/Xf/s1ZeAtQD9dhFHAS2fV+aA2Ceckz X-Gm-Gg: AY/fxX5OvD3+LuJZlN/sM5xdVfaDEb8hvdMPwNM0wcUhPg6ivLBNTcTuk0HkZU1Xk8U JVDvzgctu0nHSa5uZ4QBVkXX2ac4xNkOqA1jZ9rsfZkGjGkTKAkuVNvFESoFGP+GNVPTGp6ciMW N6NzpyticJ1ctBXlWPdN55I2Nt2rEwPIIOtPJmNa5RORggjakQjrDDurocwlvdWZivK1Ga+aGpE fTcPV1iDwI7YCrYrHckOYt+CeUhJkID+ArMdKkXiQWs/hiJKJVZ7/CHLX0UghD1tbXx8D9hwKJH CA6vi2S57xKHwPXVLeufb3pWQc86PV8n5qAPtXLqcf+7DDswxUWyrTs1kF1k0zteWQ== X-Received: by 2002:a05:6512:2c93:b0:59c:bfb8:4cf4 with SMTP id 2adb3069b0e04-59cbfb84d8bmr1104715e87.14.1768823250825; Mon, 19 Jan 2026 03:47:30 -0800 (PST) MIME-Version: 1.0 References: <54329add-59b6-4c08-96f0-a025a7804174@vondra.me> <4ff9578d-1de2-45c1-98c4-29caf99334ff@vondra.me> <183fe9ab-6010-4cca-b648-1deca332ce2a@vondra.me> In-Reply-To: From: Jakub Wartak Date: Mon, 19 Jan 2026 12:47:19 +0100 X-Gm-Features: AZwV_Qj2Mr13-Peic8bPPtTUa3MI_UXhQY54pYhTxvFpbRgYkLe4ks6DzVo5YVg Message-ID: Subject: Re: failed NUMA pages inquiry status: Operation not permitted To: Tomas Vondra Cc: Christoph Berg , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jan 16, 2026 at 10:29=E2=80=AFPM Tomas Vondra wro= te: > > Hi, > > Here's WIP fix for the root cause, i.e. handling status -2 in the two > views querying NUMA node for memory pages: > > * pg_shmem_allocations_numa > * pg_buffercache_numa > > We can't prevent -2 from happening - the kernel can move arbitrary pages > to swap, we have no control over it. So I think we need to handle -2 as > "unknown" node, instead of failing. The patch simply returns NULL > instead of the node, but in principle we might return some other value > (but IMHO we should not return the raw status, the -2 makes no sense in > our context, it's some internal kernel errno). > > The pg_buffercache_numa was not failing, it just returned the -2 status > verbatim. But I modified it to return NULL, for consistency. > > AFAIK this will fix the regression tests too - they only check COUNT(*), > not the actual values. > > I'm not sure if we need to mention this in the docs. It probably should > mention the column can be NULL, which means "unknown node". Right, OK, so I've reproduced this without patch (as You have stated, just = cause shared_buffers to swap out, in my case it was simple stress-ng -m 16 --vm-b= ytes SOME_HIGH_VALUE). It gets ERROR pretty fast: select numa_node, sum(size) from pg_shmem_allocations_numa group by numa_node; numa_node | sum -----------+------------- 0 | 24062603264 (1 row) and then after pretty soon: ERROR: invalid NUMA node id outside of allowed range [0, 0]: -2 but with patch it (which by the way looks good to me), it does not, instead I get: numa_node | sum -----------+------------- | 10821046272 0 | 13241556992 -J.