Received: by 2002:a05:7412:d384:b0:fc:a2b0:25d7 with SMTP id bq4csp5274rdb; Wed, 21 Feb 2024 13:49:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVQno3mmn4Qz7mpuSme7IOzRgfafxddfeQmEmtuxeX3zxCvfK3qzEZw1BO/kpgc51l3M7jopW65Kzl6X++/UzEUjuRPT3tJAYKbl5a/PQ== X-Google-Smtp-Source: AGHT+IFkHzZElAhsrc6AZifqwWdWfvrNxpLin1KhWhZO5HwDv4LaLbt1LzNDMdRpSu2RWk0ixRtW X-Received: by 2002:a05:6a20:4388:b0:19e:89ae:9b52 with SMTP id i8-20020a056a20438800b0019e89ae9b52mr21735576pzl.7.1708552179537; Wed, 21 Feb 2024 13:49:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708552179; cv=pass; d=google.com; s=arc-20160816; b=N6EKsM3pxCDvAza3REqMBPDv6nV0730/0hnOJ09+14JwPkBQiIQZ+ZFOCtcOCRpw2O jFAiy9CTW90QGaJCb3/aCvjMhrWouVc8nWd7lZyi5g5lRY2TqdkVGT6t5FKmSu53XxdK Z6ZnxnIo6xmabyWQMS4mdDq0a9U2JAHeAne1aW34XLhlJW6/ZfhVToJSYZyzxm+xGekH tA3k0LUdWFE/GYscivFWLR6qrPoEcUMvVag+GKTCGptGHSxBHJX+OlzwqxO/dJMSv1y6 G2z08OnGdMMrHGgceo1zM1Y5rbhP9JxMgaf5BOlx9Jjs84c5aasHGeZ90LH1Oa8ID/+m rP6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=gyDvZIu7lyAMZr8iHtIW9gaK0zzbqkQ/ZarxVd+kbsw=; fh=fQEPH859w7uWvq4bzd3EJh2AW8fGo2ANGOfOBfhIxcs=; b=N9a3an5byefngmF4qRsEIgnkwuVVv22s39JTNMIT+iSrj3G4PleEcXLH+cNB6OB8wZ M5Trq63YhFT7ICHrKVcuXxTYX8w4lbvzxSCSvey/QvLxKtGklNAF5+346R9hRMUp+yoR jd4548XTAgduTV6fPpLY19+hxAnO/5FgaSRu6JYdnYhgj+Pogoc5QAAqKCDUC5JDuQye n4R1whjAypp3bBF7SAdnm8RIt/PYbMbNEY4sbzTabmdvmlmDL7KPDE7JR+pTOf7dv9NN IApV2FWhJXJfcGWbC4PmpDagmGLNwv0RYJSpxkfZ/qADHUndvvbgdk+bsfkijzC78Gf4 Qo8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Okuurdc1; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f10-20020a170902684a00b001dc3dfe9fa6si993195pln.614.2024.02.21.13.49.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:49:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Okuurdc1; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 633B8B26AFC for ; Wed, 21 Feb 2024 21:37:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01BAC12D77F; Wed, 21 Feb 2024 21:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Okuurdc1" Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (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 96C2512882E for ; Wed, 21 Feb 2024 21:31:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708551067; cv=none; b=bfino+V5BiByAY5sxB80PKac/rY94U52crKoWee3q0LsMj3t3fMz4LqATKc88RPk3SzlX1jBy+4xr/iXayNHt3KRkb3JAcYtStmYnkNmnoH/Z1TdoWHKK9814U7P1SnUPiUhr2i77ZVkvLfNR5dM1wNFi3NzGQBenhgf3njheP4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708551067; c=relaxed/simple; bh=vkGTScK5M6Sthovdj0M+72XV5UMq/lWO1wwEeMwIR1o=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=CvLaaBbmTZhLRl0nj2UY68kQNsTapqNHbztLjCJJGIX+wXdk+DOyyJtQFN19HtVPJHLkFndJCRC/rYMCzQqsVDmOD4bIBfS0HDWPqiaVatPIAavbTuVuI1Bx1CIOW1v8qSAubUeF5Mtry9mj5AUa6CLXxWnAcpulvKoumwekgn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Okuurdc1; arc=none smtp.client-ip=209.85.167.179 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=google.com Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3bbbc6b4ed1so5263222b6e.2 for ; Wed, 21 Feb 2024 13:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708551064; x=1709155864; darn=vger.kernel.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=gyDvZIu7lyAMZr8iHtIW9gaK0zzbqkQ/ZarxVd+kbsw=; b=Okuurdc17ebSBJG7qhyTr9oJhy3C7On7Xn1CRRLP73dXm9Zd0IoaeRPZn2T/m4A/1p fO9vrZn8w9av70NWsDAuxnn8+HTGjTgpRIYYzJDrM85LDjhZp4L1ovNig38AntgOeL+G Ddfj7XnTRf3qU7qcKuliJqUR4HBwWk+zm+cEHDoR1M3wdM/qwiN86MZ/EyMMPrHOrEHi lVuQba0mQRqnpNllwCbTvbgdbL7h5trOZq8qh7A7XdGBAeL0gqrpRarm+BunqoaJ3MgE gSRULSoqJGwFwdW7nQFa/kAHrb0tA4OFkNCVIHflzk7pgtZvsmcpd4gn/a9q35wu6De4 /ajw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708551064; x=1709155864; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gyDvZIu7lyAMZr8iHtIW9gaK0zzbqkQ/ZarxVd+kbsw=; b=KJm0pHhOddV7wKPFsbZEdNn+sxkb6GtXAVnpurD1evKlbJluiC7K8W1fD1jwisoVsG E+sPKbOqRYW0iu6ocjDwAt62B05C9By9OB548LfZ566R6XxrVZrybnmvbpaPxRI/3dOb HE83YwKFEkxHLyW5Ug/jmF+1lXuGe/H314r+MyGdJDNhToUsQwJGaeWx93Q+piACET+V qJ7MV3EkTbJ+KkxA9iTWtt21eJAfdu+kqsjaldq/a1WiZrHnXC+Azd8E4v+IEG9my6fx W1cqyCppzkKtF0iSMQC2LUToh7QR5e67MgSmqweqkNQQUYJNjl8WTHv6i3NFjGwR2ZkG QBfw== X-Forwarded-Encrypted: i=1; AJvYcCWR7CZCMTRb5igES8g1ocaRgalrqu94i4F//VSX+VGxH63xfJ2hUEOdrZUo/famBZ856ank3hjJZ8n5IvhRoEjUkAAY0EkKPiG87Tmb X-Gm-Message-State: AOJu0YxoB2Ks4DBgnXjiglbIB/jKjveZZA9VqsbcPjI91r3ix8M904ka cKNd2L5hvtR6IoHA0GFM6srBmzDdiMY+xjcxG8HHVwmWzBPFb1UK/QzxAypW9EoLTXstvoD7vha eR91F9gu1F4i3n5NH2v2WJ25a1PunH/S/nM+L X-Received: by 2002:a05:6808:120e:b0:3c1:67d3:694 with SMTP id a14-20020a056808120e00b003c167d30694mr6194946oil.30.1708551064423; Wed, 21 Feb 2024 13:31:04 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240111210539.636607-1-carlosgalo@google.com> In-Reply-To: From: Carlos Galo Date: Wed, 21 Feb 2024 13:30:51 -0800 Message-ID: Subject: Re: [PATCH v2] mm: Update mark_victim tracepoints fields To: Michal Hocko Cc: rostedt@goodmis.org, akpm@linux-foundation.org, surenb@google.com, android-mm@google.com, kernel-team@android.com, Masami Hiramatsu , Mathieu Desnoyers , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 20, 2024 at 11:55=E2=80=AFPM Michal Hocko wro= te: > > Hi, > sorry I have missed this before. > > On Thu 11-01-24 21:05:30, Carlos Galo wrote: > > The current implementation of the mark_victim tracepoint provides only > > the process ID (pid) of the victim process. This limitation poses > > challenges for userspace tools that need additional information > > about the OOM victim. The association between pid and the additional > > data may be lost after the kill, making it difficult for userspace to > > correlate the OOM event with the specific process. > > You are correct that post OOM all per-process information is lost. On > the other hand we do dump all this information to the kernel log. Could > you explain why that is not suitable for your purpose? Userspace tools often need real-time visibility into OOM situations for userspace intervention. Our use case involves utilizing BPF programs, along with BPF ring buffers, to provide OOM notification to userspace. Parsing kernel logs would be significant overhead as opposed to the event based BPF approach. > > In order to mitigate this limitation, add the following fields: > > > > - UID > > In Android each installed application has a unique UID. Including > > the `uid` assists in correlating OOM events with specific apps. > > > > - Process Name (comm) > > Enables identification of the affected process. > > > > - OOM Score > > Allows userspace to get additional insights of the relative kill > > priority of the OOM victim. > > What is the oom score useful for? > The OOM score provides us a measure of the victim's importance. On the android side, it allows us to identify if top or foreground apps are killed, which have user perceptible impact. > Is there any reason to provide a different information from the one > reported to the kernel log? > __oom_kill_process: > pr_err("%s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-r= ss:%lukB, shmem-rss:%lukB, UID:%u pgtables:%lukB oom_score_adj:%hd\n", > message, task_pid_nr(victim), victim->comm, K(mm->total_v= m), > K(get_mm_counter(mm, MM_ANONPAGES)), > K(get_mm_counter(mm, MM_FILEPAGES)), > K(get_mm_counter(mm, MM_SHMEMPAGES)), > from_kuid(&init_user_ns, task_uid(victim)), > mm_pgtables_bytes(mm) >> 10, victim->signal->oom_score_ad= j); > We added these fields we need (UID, process name, and OOM score), but we're open to adding the others if you prefer that for consistency with the kernel log. Thanks, Carlos > -- > Michal Hocko > SUSE Labs