From nobody Tue Apr 7 19:54:44 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 34A9D388E59 for ; Wed, 11 Mar 2026 20:05:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773259552; cv=none; b=FxxKid96FHd0kMSrvAWtRlIMiHGYV+jJziamyqbPoFXSMva1K34T6QMNYlu/NyL1bVKOJtij/5tfj0tBQPz+RP6POKgs4Pr0aKIOmM9LDFYEhksEAFdWWNTuhUV9DLaFsFlF+wW6bVfWXLyY7CgfxH9jqN7j79gKYlyN400FpqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773259552; c=relaxed/simple; bh=8vIF8Lb5ykzhrFBUJxIpixRKe7Zi6mpz235W7zqSAmw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=QlBNwuHUn0fnOCo52YfaBnWRMgyIIZNAUIFIw8h7GePD1OUBgUtxS2Y1gAFrhXfLpoHHOSFtG/8HdsY/i26UmTsRbP1JgBxi2FDb/PAN6oSQlPeMJrdza7/JcghaE++FZSjE1htqyINUs1CnE3GP02MsUJDMKA+M2fedkVVCv2Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=G3W7qRAj; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="G3W7qRAj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773259549; h=from:from: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; bh=XAhyUCPdN0YxPo/49Qsd/d35pyJg70HQ5AoWjWJKM4M=; b=G3W7qRAjh/DSgf0lCsqFR7hFLUPUdowqyh1xlsNdz6jdGDjXFBH42rspQ7ABfyN5jbLqz0 JS4MhU9xlS0Da5j7sryJhDkHus7r8Xs8PJQz/KfNK2tQ7grdZMMG7Ie8BefnCHbwaawiyA g6O6JPpmt1lqDt+Sz7qAWsgwZXnk+gg= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-192-mfchlU81My2mdCgh7zI6mA-1; Wed, 11 Mar 2026 16:05:43 -0400 X-MC-Unique: mfchlU81My2mdCgh7zI6mA-1 X-Mimecast-MFC-AGG-ID: mfchlU81My2mdCgh7zI6mA_1773259539 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 019E218005B8; Wed, 11 Mar 2026 20:05:39 +0000 (UTC) Received: from llong-thinkpadp16vgen1.westford.csb (unknown [10.22.90.45]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A497330002D2; Wed, 11 Mar 2026 20:05:35 +0000 (UTC) From: Waiman Long To: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Tejun Heo , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Shuah Khan , Mike Rapoport Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Waiman Long Subject: [PATCH v3] selftest: memcg: Skip memcg_sock test if address family not supported Date: Wed, 11 Mar 2026 16:05:26 -0400 Message-ID: <20260311200526.885899-1-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 The test_memcg_sock test in memcontrol.c sets up an IPv6 socket and send data over it to consume memory and verify that memory.stat.sock and memory.current values are close. On systems where IPv6 isn't enabled or not configured to support SOCK_STREAM, the test_memcg_sock test always fails. When the socket() call fails, there is no way we can test the memory consumption and verify the above claim. I believe it is better to just skip the test in this case instead of reporting a test failure hinting that there may be something wrong with the memcg code. Fixes: 5f8f019380b8 ("selftests: cgroup/memcontrol: add basic test for sock= et accounting") Acked-by: Michal Koutn=C3=BD Acked-by: Shakeel Butt Signed-off-by: Waiman Long --- tools/testing/selftests/cgroup/test_memcontrol.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) [v3] Add tags and fix typo in subject line diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testi= ng/selftests/cgroup/test_memcontrol.c index 2fb096a2a9f9..a25eb097b31c 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -1280,8 +1280,11 @@ static int tcp_server(const char *cgroup, void *arg) saddr.sin6_port =3D htons(srv_args->port); =20 sk =3D socket(AF_INET6, SOCK_STREAM, 0); - if (sk < 0) + if (sk < 0) { + /* Pass back errno to the ctl_fd */ + write(ctl_fd, &errno, sizeof(errno)); return ret; + } =20 if (setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) goto cleanup; @@ -1412,6 +1415,12 @@ static int test_memcg_sock(const char *root) goto cleanup; close(args.ctl[0]); =20 + /* Skip if address family not supported by protocol */ + if (err =3D=3D EAFNOSUPPORT) { + ret =3D KSFT_SKIP; + goto cleanup; + } + if (!err) break; if (err !=3D EADDRINUSE) --=20 2.53.0