From patchwork Fri Jun 24 08:04:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 585045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F4B9CCA483 for ; Fri, 24 Jun 2022 08:04:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230525AbiFXIE6 (ORCPT ); Fri, 24 Jun 2022 04:04:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbiFXIEw (ORCPT ); Fri, 24 Jun 2022 04:04:52 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B586DB14; Fri, 24 Jun 2022 01:04:51 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id c65so2326836edf.4; Fri, 24 Jun 2022 01:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6j0Gpi54M48fI1NcNiQ2zQbh0cpYb0wFPGGgMk6DiNo=; b=fk1Q8DhcfpcNKxoNpWHiQSY9AE96A9aVxjRhZQQUWDZRdv7jEZGX6hMqBKr6rqq5fy 9t7SzX2Vl712znvGA8+d7SsV/SLjOuEz8EJqw7KMYQFjdKxhRvkPZZZiwuZ1Mbl3yEfV 0czXl+5DWtas1YhPkEGvL798aRjcHESclYc/C/XKzSoId3CQoIeGfVhaQ9gE8V4nAnvz yPNyik6e47/+4vPDqcfn3WUpjSuAR16t34HQILns5txBmvATmE4OpVbQiTQ3jTbxv/Ju QRq5NGdaccxi64UFpJMIIRqRVNhqRxqlSvbkbbvI6sIihwWIzkjAbvWZWMqIO6dN8QxY AsDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6j0Gpi54M48fI1NcNiQ2zQbh0cpYb0wFPGGgMk6DiNo=; b=7y73GjiB1DXT9pahs2jEX+bK2t3gViVXm1dWT5yal6dPlVNlGgYR3CPYPQRjGOEa9L oZstmo8tkTeqZcIoUO5bZXm8niw2+b3EQDnzKSw0WLzkVKdN+jVtZpA87t1zdrms6kdi dgExl4mZO619ikOHTD8tpFdAP09IOawwQscnjBaJMkKRYKJJ1vCkNz8HDndABqGoS+IU oi1xmA34Eps1V4Bh+/EQNuaI+jxT622UZG+1n8UmFlNqBPoYJHtku0HWggK73CzCFoq+ Y5F0EaELw4WTMFN5+ijL6UxJblfsGkQpAb17g+6VdwSEGD/En5ZS3THQE8mkAp5GdFhl F+kQ== X-Gm-Message-State: AJIora8/dDCYRgWh7XGg0Yn5hzdWrJoeKXHJDqFLQAxnQda+AsBkfukA 0QjvtbquEcUqKFSDQBnVokJpRdpn3gI= X-Google-Smtp-Source: AGRyM1srTDsD3lF1Nj8u/D/xjMuJOrSeuMWkaVaQOvHyyq+uUmVQu5uN8XQJNPLwVdaC1R98cp8x3A== X-Received: by 2002:a05:6402:350f:b0:42f:68f9:ae5 with SMTP id b15-20020a056402350f00b0042f68f90ae5mr16118492edd.36.1656057890308; Fri, 24 Jun 2022 01:04:50 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id c19-20020a170906155300b006fea43db5c1sm697779ejd.21.2022.06.24.01.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:49 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org Cc: mhocko@suse.com, Andrey Grodzovsky Subject: [PATCH 02/14] oom: take per file RSS into account Date: Fri, 24 Jun 2022 10:04:32 +0200 Message-Id: <20220624080444.7619-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624080444.7619-1-christian.koenig@amd.com> References: <20220624080444.7619-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Andrey Grodzovsky Try to make better decisions which process to kill based on per file RSS. Signed-off-by: Andrey Grodzovsky --- mm/oom_kill.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 3c6cf9e3cd66..76a5ea73eb6a 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -18,6 +18,7 @@ * kernel subsystems and hints as to where to find out what things do. */ +#include #include #include #include @@ -228,7 +229,8 @@ long oom_badness(struct task_struct *p, unsigned long totalpages) * task's rss, pagetable and swap space use. */ points = get_mm_rss(p->mm) + get_mm_counter(p->mm, MM_SWAPENTS) + - mm_pgtables_bytes(p->mm) / PAGE_SIZE; + files_rss(p->files) + mm_pgtables_bytes(p->mm) / PAGE_SIZE; + task_unlock(p); /* Normalize to oom_score_adj units */ @@ -401,8 +403,8 @@ static int dump_task(struct task_struct *p, void *arg) pr_info("[%7d] %5d %5d %8lu %8lu %8ld %8lu %5hd %s\n", task->pid, from_kuid(&init_user_ns, task_uid(task)), - task->tgid, task->mm->total_vm, get_mm_rss(task->mm), - mm_pgtables_bytes(task->mm), + task->tgid, task->mm->total_vm, get_mm_rss(task->mm) + + files_rss(task->files), mm_pgtables_bytes(task->mm), get_mm_counter(task->mm, MM_SWAPENTS), task->signal->oom_score_adj, task->comm); task_unlock(task); @@ -594,7 +596,8 @@ static bool oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm) pr_info("oom_reaper: reaped process %d (%s), now anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB\n", task_pid_nr(tsk), tsk->comm, K(get_mm_counter(mm, MM_ANONPAGES)), - K(get_mm_counter(mm, MM_FILEPAGES)), + K(get_mm_counter(mm, MM_FILEPAGES) + + files_rss(tsk->files)), K(get_mm_counter(mm, MM_SHMEMPAGES))); out_finish: trace_finish_task_reaping(tsk->pid); @@ -950,7 +953,7 @@ static void __oom_kill_process(struct task_struct *victim, const char *message) pr_err("%s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB, UID:%u pgtables:%lukB oom_score_adj:%hd\n", message, task_pid_nr(victim), victim->comm, K(mm->total_vm), K(get_mm_counter(mm, MM_ANONPAGES)), - K(get_mm_counter(mm, MM_FILEPAGES)), + K(get_mm_counter(mm, MM_FILEPAGES) + files_rss(victim->files)), K(get_mm_counter(mm, MM_SHMEMPAGES)), from_kuid(&init_user_ns, task_uid(victim)), mm_pgtables_bytes(mm) >> 10, victim->signal->oom_score_adj); From patchwork Fri Jun 24 08:04:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 585044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F1DAC43334 for ; Fri, 24 Jun 2022 08:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231225AbiFXIFA (ORCPT ); Fri, 24 Jun 2022 04:05:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbiFXIEx (ORCPT ); Fri, 24 Jun 2022 04:04:53 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1843B6DB15; Fri, 24 Jun 2022 01:04:53 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id c65so2326836edf.4; Fri, 24 Jun 2022 01:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p1KsJJhvBthReekWVkDyI4HkkhGOTDE0uEXhDskma64=; b=KRem//CoENhA5H2UpmZZdJhIsNw+EqHDcRDSpekGpVdLUsKXbAGMuEpz4BJJr9Z87z IFYClc3R1wwPUygzstZ5aUNS6Wq5y0CfGSvfoDrVHkFbu0scIpPzWzMEq6eV8O7oB/AX FqDJRWt2Ipnk6y0r0VVTgjAU7cmOXdZEoJ0Qo2ZbG6rmkxKpX6vKZa5MuOPpSarFPIOI rvJt3BfdWDmWUzFnm2BJraq/RqKiudFoTZr0bvTI3SMqicR6ERRh4vwjGTYV2bCjY/8g Cs+cebdzqLUOjb0//Sl+P40ocJPd2A5kT/PXdXVI6tczXXpaQaD+aGMxYg5hyRLGbgEA pMnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p1KsJJhvBthReekWVkDyI4HkkhGOTDE0uEXhDskma64=; b=ve4hzxF5YN0K2HZGxk44xINw2BaY8gfobyv0/JCoEedxJ15NQHQz7X6slgZszL6zQX 4KY/u9DYkeVcVQUh3zlCqKv/WI2UTQqYxvXEopXctR6WRCAJ316AlQWosfszNbSAPblZ N6rBYARA5hWVaPCCFqS9QyFLqfxY5VE58hvDu2c5QV9qlbbSkMR7sa1khpXGbMdnyqZ2 NWYDEyQc/LRBwApkSvroflrFDK9VI7Z+RaHXrjfr+DbXIz2yG8D+Zez9smIsFzZX3bdw Rx/C2li/nlJgqtvCmxHFFr/iDQ0UkWC21GaGnkyXlImk29R8FVaKkpkknPER2PkcAL75 VHtQ== X-Gm-Message-State: AJIora+JOVKHTSFj5QZd/Tl6Ienvus1rqJfN7n7ITZJdh9THuESOwFf5 RWtOypFAxIaiP+9oxTcOGi//XK7RzAI= X-Google-Smtp-Source: AGRyM1sHNTKfIbC1nDS/xDvZBcuQhpYMoeUWuMsHYIL5xwYmRCaeHIcH9pVKRTHXqSe2jlNLioeTeQ== X-Received: by 2002:a05:6402:3807:b0:435:20fb:318d with SMTP id es7-20020a056402380700b0043520fb318dmr15936277edb.272.1656057892772; Fri, 24 Jun 2022 01:04:52 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id c19-20020a170906155300b006fea43db5c1sm697779ejd.21.2022.06.24.01.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:52 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Subject: [PATCH 04/14] mm: shmem: provide RSS for shmem files Date: Fri, 24 Jun 2022 10:04:34 +0200 Message-Id: <20220624080444.7619-5-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624080444.7619-1-christian.koenig@amd.com> References: <20220624080444.7619-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This gives the OOM killer an additional hint which processes are referencing shmem files with potentially no other accounting for them. Signed-off-by: Christian König --- mm/shmem.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index a6f565308133..b068ac5ba4bf 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2209,6 +2209,21 @@ unsigned long shmem_get_unmapped_area(struct file *file, return inflated_addr; } +static long shmem_file_rss(struct file *file) +{ + struct inode *inode = file_inode(file); + unsigned long nrpages; + + /* Only account shmem files which aren't part of any fs */ + if (atomic_read(&inode->i_count) > 1) + return 0; + + xa_lock(&file->f_mapping->i_pages); + nrpages = file->f_mapping->nrpages; + xa_unlock(&file->f_mapping->i_pages); + return nrpages; +} + #ifdef CONFIG_NUMA static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol) { @@ -3811,6 +3826,7 @@ EXPORT_SYMBOL(shmem_aops); static const struct file_operations shmem_file_operations = { .mmap = shmem_mmap, .get_unmapped_area = shmem_get_unmapped_area, + .file_rss = shmem_file_rss, #ifdef CONFIG_TMPFS .llseek = shmem_file_llseek, .read_iter = shmem_file_read_iter, From patchwork Fri Jun 24 08:04:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 585043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F218C43334 for ; Fri, 24 Jun 2022 08:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231329AbiFXIFb (ORCPT ); Fri, 24 Jun 2022 04:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231171AbiFXIE6 (ORCPT ); Fri, 24 Jun 2022 04:04:58 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1E446DB29; Fri, 24 Jun 2022 01:04:55 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id z7so2267681edm.13; Fri, 24 Jun 2022 01:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=693VGEXA19r817fSkp2HQ7yboKFhWxOFXyjV0CxaoD8=; b=bPO2J7WjvzBcNpfIHv7dl25KdodmC5owqOj/ao7wNhAnd3KqvnC/BclTClPISp0FIg ErmyDY0AnX0VgWurEGxdWOwwQCER5PQ8tiXh8uXejlJ71JfTDxMflFOmlfyeUtCgpzYl GCNQ6a3+oelf8dKov7UIjW0o/PNElo5JTYQYT16G+EdOs+rFrzp8MWQJaRzfStUeqoJU MAaIvGG9hQ1CJqJB/mBg7bHcQtPQ4wHEK/inBzbq6m/eeuM3S02aw2kKyDLmLsG/efiK hoTfCJ2TyZ5SBAvoWyQg6Igc48Som98fLO9wcbofHL1PNn01cJ6620JB+zhOQQSTbm9Y 3eGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=693VGEXA19r817fSkp2HQ7yboKFhWxOFXyjV0CxaoD8=; b=JG8x6hHWP2jvR+ExlDdu5kPNh0xaie6km/fjef+HhVLf2ANcJbib/kiN9uqs1LXaNv 8V3E94wENGmAZqVh4RVLK2IBzVhN79QntITLIqTJDnaZsq9pqfUnTG9o2SYHyLQ13rv+ 87QHVtJG64q04gDymi2FxOBR0AXmG16HwgopIhgXHVovcWjDnC7GrrQzDahMxI4ZuITU Wml7kXhY80BQP/jBt+nqTsQ/wdED8c8ZC3SaKCLciyDNZyckqK7tWyWYLnouyxt9hr/w DjDhG1xrWBP/wvu7yc1Y8sO3de1vRdd1LFyEAh8StVYUVPal6SCzBU2jQVFGKu/ysjV4 voAQ== X-Gm-Message-State: AJIora8BhX503ECyJai4SyXPneTo14MM5cpWfOOnv+SQc0smBova3caa SempWmfU98wwpakyHXnNDWQax5p/SC4= X-Google-Smtp-Source: AGRyM1sUzCXIERY4xHIb6/DBgczJUjRT28k1Ye0d5toII0cbHGJ1AwKeLvxpb+HA2e+MaKqALcspsA== X-Received: by 2002:a05:6402:5188:b0:437:618c:c124 with SMTP id q8-20020a056402518800b00437618cc124mr290922edd.233.1656057895213; Fri, 24 Jun 2022 01:04:55 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id c19-20020a170906155300b006fea43db5c1sm697779ejd.21.2022.06.24.01.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:54 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org Cc: mhocko@suse.com, Andrey Grodzovsky Subject: [PATCH 06/14] drm/gem: adjust per file RSS on handling buffers Date: Fri, 24 Jun 2022 10:04:36 +0200 Message-Id: <20220624080444.7619-7-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624080444.7619-1-christian.koenig@amd.com> References: <20220624080444.7619-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Andrey Grodzovsky Large amounts of VRAM are usually not CPU accessible, so they are not mapped into the processes address space. But since the device drivers usually support swapping buffers from VRAM to system memory we can still run into an out of memory situation when userspace starts to allocate to much. This patch gives the OOM killer another hint which process is holding references to memory resources. A GEM helper is provided and automatically used for all drivers using the DEFINE_DRM_GEM_FOPS() and DEFINE_DRM_GEM_CMA_FOPS() macros. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/drm_file.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/drm_gem.c | 5 +++++ include/drm/drm_file.h | 9 +++++++++ include/drm/drm_gem.h | 1 + include/drm/drm_gem_cma_helper.h | 1 + 5 files changed, 40 insertions(+) diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index ed25168619fc..b60795c5067c 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -1049,3 +1049,27 @@ unsigned long drm_get_unmapped_area(struct file *file, #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ EXPORT_SYMBOL_GPL(drm_get_unmapped_area); #endif /* CONFIG_MMU */ + + +/** + * drm_file_rss() - get number of pages held by struct drm_file + * @f: struct drm_file to get the number of pages for + * + * Return how many pages are allocated for this client. + */ +long drm_file_rss(struct file *f) +{ + + struct drm_file *file_priv = f->private_data; + + if (!file_priv) + return 0; + + /* + * Since DRM file descriptors are often DUP()ed divide by the file count + * reference so that each descriptor gets an equal share. + */ + return DIV_ROUND_UP(atomic_long_read(&file_priv->f_rss), + file_count(f)); +} +EXPORT_SYMBOL(drm_file_rss); diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index eb0c2d041f13..69b3e93db816 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -256,6 +256,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) drm_gem_remove_prime_handles(obj, file_priv); drm_vma_node_revoke(&obj->vma_node, file_priv); + atomic_long_sub(obj->size >> PAGE_SHIFT, &file_priv->f_rss); drm_gem_object_handle_put_unlocked(obj); return 0; @@ -291,6 +292,8 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle) idr_remove(&filp->object_idr, handle); spin_unlock(&filp->table_lock); + atomic_long_sub(obj->size >> PAGE_SHIFT, &filp->f_rss); + return 0; } EXPORT_SYMBOL(drm_gem_handle_delete); @@ -399,6 +402,8 @@ drm_gem_handle_create_tail(struct drm_file *file_priv, } *handlep = handle; + + atomic_long_add(obj->size >> PAGE_SHIFT, &file_priv->f_rss); return 0; err_revoke: diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h index e0a73a1e2df7..7c6ca13d8549 100644 --- a/include/drm/drm_file.h +++ b/include/drm/drm_file.h @@ -366,6 +366,13 @@ struct drm_file { #if IS_ENABLED(CONFIG_DRM_LEGACY) unsigned long lock_count; /* DRI1 legacy lock count */ #endif + + /** + * @f_rss: + * + * How many pages are allocated through this driver connection. + */ + atomic_long_t f_rss; }; /** @@ -430,4 +437,6 @@ unsigned long drm_get_unmapped_area(struct file *file, #endif /* CONFIG_MMU */ +long drm_file_rss(struct file *f); + #endif /* _DRM_FILE_H_ */ diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 9d7c61a122dc..b64cad26e9e9 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -338,6 +338,7 @@ struct drm_gem_object { .read = drm_read,\ .llseek = noop_llseek,\ .mmap = drm_gem_mmap,\ + .file_rss = drm_file_rss,\ } void drm_gem_object_release(struct drm_gem_object *obj); diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index fbda4ce5d5fb..8c56cbc8d10f 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -273,6 +273,7 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, .read = drm_read,\ .llseek = noop_llseek,\ .mmap = drm_gem_mmap,\ + .file_rss = drm_file_rss,\ DRM_GEM_CMA_UNMAPPED_AREA_FOPS \ } From patchwork Fri Jun 24 08:04:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 585042 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1592CCA47E for ; Fri, 24 Jun 2022 08:05:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231409AbiFXIFn (ORCPT ); Fri, 24 Jun 2022 04:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231231AbiFXIFB (ORCPT ); Fri, 24 Jun 2022 04:05:01 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F40B06DB28; Fri, 24 Jun 2022 01:04:57 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id eq6so2313776edb.6; Fri, 24 Jun 2022 01:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CVQLS1Q8p0L2oqy2feCuipYYw0Dn51iYeixzeYC0qk0=; b=diumkHDMGen9Vt3PpkuAbvqzWKQd+Xdn973nNKdfdCDDC0zTX2C6hvIxsHe2V7Hoc4 IOhBR2vnm8dxvhsKFIBXPaolCk/OFXCBQ1WZCwL71kg8/Qq8WUQziQwUP00AOcwUcOGP rXTcnuW7puIRMcesyziDQyu7bT1G2aJvnhdPeFeaq+EwQpiHIGMo14FD4eE8URrxEDxV 0m2ZDeucEfDeKkG17Nd8V6yPSz995Flq0dRdec0ubvhe6xb2D8xZHUXfzD0udY0tRU0C HcnFjUnQwXhFVgFVmkiIUcsMCluaFxgfHNgP1bHGOZQJ0mTg8yzEf2GVutNriYht8F60 tNsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CVQLS1Q8p0L2oqy2feCuipYYw0Dn51iYeixzeYC0qk0=; b=ku7kr8A/OMxxUJeWx/wLEJs9GrdDqw52ECkUkIsDmSIwD/biSwtzFQ2unXmBVtBZ+T 4TikQqY8L+2o5uNIiw3ewIy6fbGuIMypqOFarbX/PdgjDQUik+nNL+FMTQ+PKrgaPPFf RLFoKS5EMY462R5cZeYcxmxjAGH9FzzauwCbax20wx78qLLd/LEkmNgVTTYL6Ci3Zi9R kVFhFUbdnNXztgVbDHWAgZGRUP8Ocp4B7e9RM+eoAWcLKGWyAe03ND8qxVebjDKc0mDh vl4xCp9EJblhrLoRHe/ICeo3LN7UGqAWMP3tzZcBezzp1HQVfmJbB2vU9YBURCPU0htP eVFA== X-Gm-Message-State: AJIora82WTESJjaigjzFrS3CF+QejS3gyjFpvPukBG/Ih9HunL4gPA9m ZCPMEI/VNol/RJ7B52Ba6AyzhZDalqs= X-Google-Smtp-Source: AGRyM1usD8rMmmeAdvKoxrU4g0pKdJN3rPJZdiIs4qY40gFmdzYVGQwJIExPFW+J17A2KjUq7SPWiA== X-Received: by 2002:a05:6402:4408:b0:435:9ed2:9be with SMTP id y8-20020a056402440800b004359ed209bemr15656191eda.81.1656057897642; Fri, 24 Jun 2022 01:04:57 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id c19-20020a170906155300b006fea43db5c1sm697779ejd.21.2022.06.24.01.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:57 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org Cc: mhocko@suse.com, Andrey Grodzovsky Subject: [PATCH 08/14] drm/amdgpu: use drm_file_rss Date: Fri, 24 Jun 2022 10:04:38 +0200 Message-Id: <20220624080444.7619-9-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624080444.7619-1-christian.koenig@amd.com> References: <20220624080444.7619-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Andrey Grodzovsky This allows the OOM killer to make a better decision which process to reap. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 8890300766a5..4508791fe80c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2635,8 +2635,9 @@ static const struct file_operations amdgpu_driver_kms_fops = { .compat_ioctl = amdgpu_kms_compat_ioctl, #endif #ifdef CONFIG_PROC_FS - .show_fdinfo = amdgpu_show_fdinfo + .show_fdinfo = amdgpu_show_fdinfo, #endif + .file_rss = drm_file_rss, }; int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv) From patchwork Fri Jun 24 08:04:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 585041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DDAACCA47E for ; Fri, 24 Jun 2022 08:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231489AbiFXIF7 (ORCPT ); Fri, 24 Jun 2022 04:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230476AbiFXIFP (ORCPT ); Fri, 24 Jun 2022 04:05:15 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43B4A6DB3E; Fri, 24 Jun 2022 01:05:00 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id ej4so2305709edb.7; Fri, 24 Jun 2022 01:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=byPE9Yoru8EMtsMIQe5jAdiqqlz8rrO56DVvtVJd9qg=; b=m1LPw4Tq7YAn8lQCGgWgt12CjzJ5ei1Ei63rf/aKMcF5rpgBfXhWWd5y3NKVG8Ui9/ K3F30mqlEy32o+QZsZXlA17af4wRr1DVKixhlju+deheafQ/NAXkt5GRlFmAkXrz01om TzwlkMMWSIsZz8Y8uObLx5ljXVdIXmDX3AUzGfBhaZh2KCqzGxsWKyfjOqHtTTOnuQk3 r1HIiRKeCgO4p1DUTcPzLqAFw481eF/Afji3PnuaKxzRhlw9/Ofd3QbWU/gWWeNF2Y9Z eMVfDCvHAUic+3PY3ZEtifzoXXEm0gqpa/KTCrNtzATjGFHR2fzV08RAqKXrhHMLRFyL Yixg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=byPE9Yoru8EMtsMIQe5jAdiqqlz8rrO56DVvtVJd9qg=; b=vBRBjATHVJZMQcTviNAFJt1x76Skz8TnfTQIuqI9oOBvyhNx+R90hezpFVpm4YVqDz b7hdq/NGPlgl7P89EltJMwBSEFcSEgOMce4frX8YhEc2G7QvXczlGimxcMI5UItBHKEN 0csuNd/KXWAZWj1H9zkl43Hjc/BNJXwpnPPsVJzwzrINvsW4fb3FNbPqbRs1HeCE5Kzb TZ99wExNMO/BB8wVdE/7Onjqoabpw5Ps3ybmURVsIV5MCEFMp2LfVFqpo1P54HWvzQVn Vg0z7L41U4EOAz7J1NHS7imTJUw7Qeb8GHfyyKpSXsAc5dGCrz6jUhSbfruEBAmvhmqs I9hQ== X-Gm-Message-State: AJIora9MkD7ARa1UrdVCHvrO9i46efGO5KzxmDFjTNqhXX2G7o4LPuV+ BT+rl7vvwV0sFCIe69p/Q30Vd49W5zA= X-Google-Smtp-Source: AGRyM1tei8ieA1a6mCZFwIOAyKz2hIJ91XJFBH3Ye843yczThgaTMvzSiEfsJRV0/KOD+tyxr8SMCg== X-Received: by 2002:a05:6402:2790:b0:431:4bb6:a6dc with SMTP id b16-20020a056402279000b004314bb6a6dcmr15766928ede.48.1656057898870; Fri, 24 Jun 2022 01:04:58 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id c19-20020a170906155300b006fea43db5c1sm697779ejd.21.2022.06.24.01.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:58 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Subject: [PATCH 09/14] drm/radeon: use drm_oom_badness Date: Fri, 24 Jun 2022 10:04:39 +0200 Message-Id: <20220624080444.7619-10-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624080444.7619-1-christian.koenig@amd.com> References: <20220624080444.7619-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This allows the OOM killer to make a better decision which process to reap. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 956c72b5aa33..11d310cdd2e8 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -550,6 +550,7 @@ static const struct file_operations radeon_driver_kms_fops = { #ifdef CONFIG_COMPAT .compat_ioctl = radeon_kms_compat_ioctl, #endif + .file_rss = drm_file_rss, }; static const struct drm_ioctl_desc radeon_ioctls_kms[] = { From patchwork Fri Jun 24 08:04:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 585040 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10D5FCCA473 for ; Fri, 24 Jun 2022 08:06:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231613AbiFXIGC (ORCPT ); Fri, 24 Jun 2022 04:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231361AbiFXIFf (ORCPT ); Fri, 24 Jun 2022 04:05:35 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09BD96E795; Fri, 24 Jun 2022 01:05:04 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id ge10so3073474ejb.7; Fri, 24 Jun 2022 01:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7h6tONB4sw4uv1o8ITO08dQoAN0r8TWfzTc1cDvUnqs=; b=Q59ZDM0bs66kYTouHFV3SH7kQiFRv8zAdPLal5R6bK6lLwicp/kD7pik3lBee8DZX6 WjFSGBfwF+GZvlJE8V2r4yZYlHtq+V7w5wxAfdmue81Rk5Au3jDlZEuUJFHZndYxL05t Ibe4zJZteTFiI3OYBpLOLUg3BL649o69+FMAHcL8GF+ZgZAjH9/pTivOYrkyoaDuf/d6 QStbApg579KEKEi3o8lC8TkfL1GqADjPzKl4hmJsbaygYpN4yg8E0HDtU5D+m69zgWyk oqqPfy5Xdm5n/aLuRFeGPi/fosEZBhi026xzbJX77OYzK7dtCEyZRZkwWliyAnH8t2Be qmkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7h6tONB4sw4uv1o8ITO08dQoAN0r8TWfzTc1cDvUnqs=; b=QYwGglxlM2PQF1c8GWGrvdwWE/6/+rbGAc1sg79rrpP3b7aZsDdWHpHHpmJS2h7Z80 OGrx0Wu/KRXHrcQSVAPFqX/TWl4f8eB97r5BBsESVkFmEuWz1gczt2m6iIa3lJF4GTEh 31R8U0E2rmd93FMunymvnXY+bDm6VGxoxupCy6xnNOMbEvjxcYPAgjEvI59tRBLvHI5q 7h1rBlDi6obfNtL0ucQ8GLpkP63i6HQbCAQtKdNuFgGvGxF9cUS/1pm4pd+/x+dPinH/ M0Yhh5T+2bwEHF+GesMZFGw6ByhQ2xkWaxsz2WooNwO6/ImAdW6cTIyaKU5fb/654Nas i13Q== X-Gm-Message-State: AJIora8qBX39a2Sbo0c+SwuMl33y9xnX7vjNmZ6TfM9SP6er5OlqM8Nu +9RlqDWy6LK51oKfOuy/SkWajUXQM+M= X-Google-Smtp-Source: AGRyM1u1kM9hV5B2jw9gM+JFOfPel32sur1C9sCcKAHE7MFpkQ9lyzjasZeMq//UEzPa6HSaMFHF8w== X-Received: by 2002:a17:907:97d1:b0:722:e6fc:a04 with SMTP id js17-20020a17090797d100b00722e6fc0a04mr12082666ejc.217.1656057902587; Fri, 24 Jun 2022 01:05:02 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id c19-20020a170906155300b006fea43db5c1sm697779ejd.21.2022.06.24.01.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:05:02 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Subject: [PATCH 12/14] drm/omap: use drm_file_rss Date: Fri, 24 Jun 2022 10:04:42 +0200 Message-Id: <20220624080444.7619-13-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624080444.7619-1-christian.koenig@amd.com> References: <20220624080444.7619-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This allows the OOM killer to make a better decision which process to reap. Signed-off-by: Christian König --- drivers/gpu/drm/omapdrm/omap_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index eaf67b9e5f12..dff637de00a3 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -684,6 +684,7 @@ static const struct file_operations omapdriver_fops = { .poll = drm_poll, .read = drm_read, .llseek = noop_llseek, + .file_rss = drm_file_rss, }; static const struct drm_driver omap_drm_driver = { From patchwork Fri Jun 24 08:04:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 585039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75705CCA47E for ; Fri, 24 Jun 2022 08:06:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231267AbiFXIGQ (ORCPT ); Fri, 24 Jun 2022 04:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231373AbiFXIFl (ORCPT ); Fri, 24 Jun 2022 04:05:41 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ADFE6E7AE; Fri, 24 Jun 2022 01:05:06 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id q6so3012304eji.13; Fri, 24 Jun 2022 01:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EK5bTabBrzOC4s5o5qACkkoAhewHbBIhpYTiUtnXhVE=; b=JwN96QcsgT/HsX0Xpol3mA630eF5N5PgavN/AUY9qBXwAsuVmy5cd/GZroEBwxc86X ZaDki0JPCb7oEXIMUIfGTswi25k7wAP19cnFbDOv/5t9BukJv9rDcgt58DFQ74NADH2u CYXiAOkYs3SpdYAaOxY3UUVCX6ptHEJ6TRdbP7p4or3Zgu3/WAjyLLMK5jZ7vcqCp7eW EZMJA+g9/yiNDw7fyROAvFU5wIayjnD37MVXkIpRkTRGWcd7zygExPX5kLKinTCY8K/T 5pdb6n5eb6/P1j1smDPETJawXNBlVLLfjUdE34ynUZs+JMkdILaXVbWdyIS5dNH8CO+w oVxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EK5bTabBrzOC4s5o5qACkkoAhewHbBIhpYTiUtnXhVE=; b=kCJf2k3X5MoX9kD1lSJnnK95Y5OR4Q4dPajw0uVAm8iuRGfEdaeGKZ1L31zjY3iZlY eK6Kjtmj6X0341nwUHA+mVHJ7q4WUFliDHfeeEQYYFGg4IViIVUhLRdV4Gy39ftqfZgi 53RRbWtc+CJtSKU3a0MkKF4LkPbOOnS0JYz5NLM1TzqfqqTUkrTqi3lNuQKPz/01O5nG YoDFKyKKIMba6p/ZtClpglZFYGzs9obczrcfnr/d3FSPar6msl4rmnKoD3iNwyeCyMd7 VUunAL1oYggh+N+YfZQ//Jcg4iUspN6HmtIbQmHiHiEFMXogFqT9qP02XfO7fu7BVIGg DTTA== X-Gm-Message-State: AJIora/+32/ulkw+uG2WW1Zr3LqfLFnySJx6L/UduM9utPWQ3TAD7uBR XgdCWhBMgu9gfaQRdbnZHIomBAfqpEw= X-Google-Smtp-Source: AGRyM1tgbH7HQwAMplhNlcow9evBtQqHgtM4KLSWjdQaSt6HlGVy+kDMyMimMYEkA9mtx94cpAF30g== X-Received: by 2002:a17:906:7a54:b0:722:e8e3:ef60 with SMTP id i20-20020a1709067a5400b00722e8e3ef60mr11829570ejo.453.1656057904986; Fri, 24 Jun 2022 01:05:04 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id c19-20020a170906155300b006fea43db5c1sm697779ejd.21.2022.06.24.01.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:05:04 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Subject: [PATCH 14/14] drm/tegra: use drm_file_rss Date: Fri, 24 Jun 2022 10:04:44 +0200 Message-Id: <20220624080444.7619-15-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624080444.7619-1-christian.koenig@amd.com> References: <20220624080444.7619-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This allows the OOM killer to make a better decision which process to reap. Signed-off-by: Christian König --- drivers/gpu/drm/tegra/drm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 4cdc8faf798f..cc0c2fc57250 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -804,6 +804,7 @@ static const struct file_operations tegra_drm_fops = { .read = drm_read, .compat_ioctl = drm_compat_ioctl, .llseek = noop_llseek, + .file_rss = drm_file_rss, }; static int tegra_drm_context_cleanup(int id, void *p, void *data)