From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3ABC3090FA for ; Tue, 23 Dec 2025 16:18:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766506706; cv=none; b=a0I62hWguBQBZP00f4n/X8dXJWUm08zbS5J/yZSq7G/jexfVFmpKKVDkhgjODLOSJnXfHhjVJ38gF8vLy1tmsCyWf9/WHORBDwRkh5z3LIAEt6FCgxY8zE/QRDTCZDCsnSxNw/NBPrU5FrsjasxQJc6J9DYxzqKB5g9KzgjT9K0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766506706; c=relaxed/simple; bh=4ikesTTr3gH957w8Rz5esRmJyY+21//TWoL1liu9TsI=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=jw8gYkW0ipq8H1ERZY0hn1R5nx36vQD0jDx+qrjcg19tRxTHGMm9jvk1k8HjIrBzzLxzKVKM929Cu2czs2eR/ouw92XWlIoBvFhgApn/rDQXiLI3M50RrtuUMKCSX9TeZAv88R9rHzFlgpX08kKOJnP2wnbTDrIduIpNS5qcoy0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=a6ei8ziB; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="a6ei8ziB" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-47777158a85so56965065e9.3 for ; Tue, 23 Dec 2025 08:18:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766506703; x=1767111503; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Gp9XbXDpsLxRfCX6IDYmiMiyLFvCv3BI5tK1fIK0sqc=; b=a6ei8ziBJuNDsz54qm/d+mRhr26lLt+3hV/set14heK9QEgt4erLBiGigU5PkW0aQ9 5vhalN8DHnhs16X/0CVZLyPFGc3c3XRQH1olqqFyqYAi0uTFIuDrR7+GiVJwyBn9TL8j 3rW8ULL1bM89gVu8FYiROwCpcpHrGgj//wIxWqrG5qcDPnrYqpp885uBnOS8UubiEFyM NNCFjUzoJLBaL9fvtX/lcP0foHWapKP/ZIo/63ACVtiFkLlUh2eHJ/XCvn08k4Dyonw5 3h3FN6gyHFlxSU9CwWQnoWM4DujL7UiLXTed5NB1WgupRyaoYweAlk/X37gKtRIIY9hi J/Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766506703; x=1767111503; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Gp9XbXDpsLxRfCX6IDYmiMiyLFvCv3BI5tK1fIK0sqc=; b=nSbIYXmEO6CO9a5p0h6DZ9isFSqQ8n5O+5OQgl67vs8A8sngCkkJBiwVTD9Ue1x+U9 DLYy4BsTLEMF4rh92bOM+Q9cFveczuQvxt+l5KphOer38d1oKkCdIepQfBs8C+34sS2P rywE0iQwFbeuU0ElGRkpPkyDydRPT0ZVqH8xytua2hX94w8uViE2VzuEquwbvkKBr8eQ at8PtNfTHWd5W8m1Uc5widpu7g73erVImT+5DZDftETXAz6ly7cNyMbgmTER4sH5KRPm LeRsuFBnju6lxYAYS/vqNQ8eUVL1uqTY6nBVxqVC3oFlep4ldK/bC0HJ8iuwQoCazjhz tusA== X-Forwarded-Encrypted: i=1; AJvYcCUdPNyh3epV5i+L2dwpmgc26NCO7+/YnC7/ziJBaRaZmlGUG+qTeBKfxhD1Lp2AN/OqnWwof4D17QmAtCo=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8kTXGBdO+qmxgJxZHd7brzYFBmF7VSMeACXLX82LwNwc5rUsK tnDXg30queSnNOROT6zLxCubOPXzKTKeDwjhGjQzklnu5snH3Ya2z1jjnoOm9KmBtivRDBd/Gq4 nNtqZzglVF8BLhw== X-Google-Smtp-Source: AGHT+IGPr3MNh9Y63iLCh43jSDD1otDWg2upubHvHKONp3Z/jU8xumFyRt2FzEbY0GIFeXDVV9+gjwkh4PeGrQ== X-Received: from wrs12.prod.google.com ([2002:a05:6000:64c:b0:42f:bb46:77bd]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600d:115:b0:46e:37fe:f0e6 with SMTP id 5b1f17b1804b1-47d1997e733mr103467595e9.30.1766506703258; Tue, 23 Dec 2025 08:18:23 -0800 (PST) Date: Tue, 23 Dec 2025 16:18:09 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAMHASmkC/x3MTQ5AMBBA4avIrE3C+AmuIhbFlAkpaVUk0rtrL N/iey84tsIOuuQFy7c4OUyMPE1gWpVZGGWODZRRlRMVOJa4eSMX+ihR7fsxYa24mXU2NqoliPK 0rOX5r/0QwgcV4GlIZQAAAA== X-Change-Id: 20251223-b4-kunit-user-alloc-6ae8df0b8a92 X-Mailer: b4 0.14.3 Message-ID: <20251223-b4-kunit-user-alloc-v1-0-fb910ae0e50c@google.com> Subject: [PATCH 0/3] EDITME: cover title for b4/kunit-user-alloc From: Brendan Jackman To: Brendan Higgins , David Gow , Rae Moar , Kees Cook , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Brendan Jackman Content-Type: text/plain; charset="utf-8" kunit_attach_mm() leaks an mm_struct (verified with dumb printf debugging). Fix that. In the process, add a new kthread mm operation, and clean up some nearby cleanup code in the KUnit lib. --- Here's how I understand mm refcounts: funcs | counter | manages lifecycle of... -------------------------------------------------------- mmgrab()/mmdrop() | mm_count | mm_struct and PGD -------------------------------------------------------- mmget()/mmput() | mm_users | userspace address space All mm_users references share a single reference to the mm_struct. --- Brendan Jackman (3): kunit: test: Delete pointless resource API usage kthread: Add kthread_take_mm() kunit: test: fix mm_struct leak in kunit_attach_mm() include/linux/kthread.h | 1 + kernel/fork.c | 3 +- kernel/kthread.c | 36 +++++++++++++++++------ lib/kunit/user_alloc.c | 78 +++++-------------------------------------------- 4 files changed, 37 insertions(+), 81 deletions(-) --- base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578 change-id: 20251223-b4-kunit-user-alloc-6ae8df0b8a92 Best regards, -- Brendan Jackman