From patchwork Fri Jun 24 08:04:31 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: 12894105 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D3DFC43334 for ; Fri, 24 Jun 2022 08:05:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5E0C1121EC; Fri, 24 Jun 2022 08:04:54 +0000 (UTC) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D2A810FB37; Fri, 24 Jun 2022 08:04:50 +0000 (UTC) Received: by mail-ed1-x529.google.com with SMTP id cf14so2302222edb.8; Fri, 24 Jun 2022 01:04:50 -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=ltQpZ7oW1QsVH1f1jCapXhBdDu/pMzI69BR3W0aWJiY=; b=BCLBGzCDM3dicFZ1OGIFkOsdf2V521mMysBEJ9iinveVKjuPTsLrqFdJi734Z1uZvp BrIl/Z9vn8vFkyDOHWmnKxo21xK+tLMDYTST34w4v8TV5nWFn9JLHMcOYZM1aHPYbEeD 282A6fO+GqmoGy5VHzTzkXXC9jDOLaPtweOGDMSO0oqWtHIb7gpQJUaCuMu88rOwe2BD crWt+l2Vv9WpcgtJbnfxcqiFAzAJtXlpuRnoAfr2x/1dRrw8Nn1n/TUXtsDtfcmdgOF3 YGwme/GeeP+MA8N7frvR6cGiLzhNFciaj5ku28X9lFYuS1JLv1ymQIO3PkoxpTVbMdZb ASwA== 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=ltQpZ7oW1QsVH1f1jCapXhBdDu/pMzI69BR3W0aWJiY=; b=lYbMKuRlrxopH5uARynrZSMJ1siUlyNnfPRPE29Z+PBBuSm8Ipn1qoSlCpfa4+u3yG NByaGocrWJxT2/SpEyBaUGV/lDvhy7t0nJNhNpEVHQgvkZK0nKBUjhfPZvMN/8eTKXug HSFBSduSxevcsvUAMSvAMC4JtAbL/c4iCqM1OBwDDGQBhNRcdEq+KsS15B35ZiNhXYFa 4bIKmjif4Unnhh4LAgSrbkcu7XSC0zhWUvN8RZE4oTMExx5RuIInNMsSj9rWUHFKvd9H OxKAh3KJ5j4jDjtmvqpUIzn8HzhRqZYc/5grtRAPUurLF4SOhFEKEG1sMQqK5LEXwEEG kuYA== X-Gm-Message-State: AJIora8x5GEt0VkmH7Fsbfcb9la3gSlpkR2xcI5PYAjlackvalwREHaE fhZAnQG/TBidpigu4sOweSs= X-Google-Smtp-Source: AGRyM1vqTm2oWNscqLmlMW8s9dcXBhWIE7N6JaZpirobITGNlD2rMAul00q8pM0x95n+ay4p5Kh9SQ== X-Received: by 2002:a05:6402:358c:b0:435:9daf:e825 with SMTP id y12-20020a056402358c00b004359dafe825mr16018406edc.375.1656057889076; Fri, 24 Jun 2022 01:04:49 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:48 -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 Date: Fri, 24 Jun 2022 10:04:31 +0200 Message-Id: <20220624080444.7619-2-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 Subject: [Intel-gfx] [PATCH 01/14] fs: add per file RSS X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Grodzovsky , mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Andrey Grodzovsky Some files allocate large amounts of memory on behalf of userspace without any on disk backing store. This memory isn't necessarily mapped into the address space, but should still accounts towards the RSS of a process just like mapped shared pages do. That information can then be used by the OOM killer to make better decisions which process to reap. For easy debugging this also adds printing of the per file RSS to fdinfo. Signed-off-by: Andrey Grodzovsky Signed-off-by: Christian König --- fs/file.c | 23 +++++++++++++++++++++++ fs/proc/fd.c | 3 +++ include/linux/fdtable.h | 1 + include/linux/fs.h | 1 + 4 files changed, 28 insertions(+) diff --git a/fs/file.c b/fs/file.c index 3bcc1ecc314a..b58730a513be 100644 --- a/fs/file.c +++ b/fs/file.c @@ -1307,3 +1307,26 @@ int iterate_fd(struct files_struct *files, unsigned n, return res; } EXPORT_SYMBOL(iterate_fd); + +static int sumup_file_rss(const void *sum, struct file *file, unsigned n) +{ + if (!file->f_op->file_rss) + return 0; + + *((unsigned long *)sum) += file->f_op->file_rss(file); + return 0; +} + +/** + * files_rss- how much resources are bound by opened files + * @files: opened files + * + * Returns sum of all resources bound by files not accounted in file systems. + */ +unsigned long files_rss(struct files_struct *files) +{ + unsigned long sum = 0; + + iterate_fd(files, 0, sumup_file_rss, &sum); + return sum; +} diff --git a/fs/proc/fd.c b/fs/proc/fd.c index 913bef0d2a36..9943bfca74f7 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c @@ -59,6 +59,9 @@ static int seq_show(struct seq_file *m, void *v) real_mount(file->f_path.mnt)->mnt_id, file_inode(file)->i_ino); + if (file->f_op->file_rss) + seq_printf(m, "rss:\t%lu\n", file->f_op->file_rss(file)); + /* show_fd_locks() never deferences files so a stale value is safe */ show_fd_locks(m, file, files); if (seq_has_overflowed(m)) diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index e066816f3519..101770266f38 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h @@ -122,6 +122,7 @@ void do_close_on_exec(struct files_struct *); int iterate_fd(struct files_struct *, unsigned, int (*)(const void *, struct file *, unsigned), const void *); +unsigned long files_rss(struct files_struct *files); extern int close_fd(unsigned int fd); extern int __close_range(unsigned int fd, unsigned int max_fd, unsigned int flags); diff --git a/include/linux/fs.h b/include/linux/fs.h index 9ad5e3520fae..edacbdce5e4c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2003,6 +2003,7 @@ struct file_operations { loff_t len, unsigned int remap_flags); int (*fadvise)(struct file *, loff_t, loff_t, int); int (*uring_cmd)(struct io_uring_cmd *ioucmd, unsigned int issue_flags); + long (*file_rss)(struct file *); } __randomize_layout; struct inode_operations { 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: 12894103 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E592DC433EF for ; Fri, 24 Jun 2022 08:05:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 67F7A1120BE; Fri, 24 Jun 2022 08:04:53 +0000 (UTC) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by gabe.freedesktop.org (Postfix) with ESMTPS id CD26A1120BE; Fri, 24 Jun 2022 08:04:51 +0000 (UTC) Received: by mail-ed1-x535.google.com with SMTP id z11so2295706edp.9; 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=2z0zu7UN9NvdPF84ElWpoaBDz/dxdDfPIDw9mjPIIBUMqiudj8d+QHPr5gL4m+5bkf +al3JDe18Ei2pEIatvbEbGkWJxvEKIGKHmcAocWmvig8sIg7xKPTNI6oXGadpLM6Or/A 3S3pOiHGhnFe0wPR5VOh4wzEszmpXdp/EV9JL0J8Ce/fGdr7BP2eKnzbmgX3XYHBUn8t TFMwapI5dXjya7/GS6LHJovsxp72EetpUPSC/zz3RQGjMAmA5g8PwQdwkstx+/IzhlRS 1ZubKiF7evMSKmepNfTGwHeo5S5vUbyKmu3hifQVoocCIjnCSIwLm9gD8AXXamMbZgcI WWXw== X-Gm-Message-State: AJIora+re+1RMGfkdXK+BwA26UYhcJvpAKoucNTSOQyBZD+mVG/LfaXd 5h1mqCjz+Tg+sIpARs09hyo= 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 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 Subject: [Intel-gfx] [PATCH 02/14] oom: take per file RSS into account X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Grodzovsky , mhocko@suse.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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:33 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: 12894106 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1445C43334 for ; Fri, 24 Jun 2022 08:05:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5DDEE112B47; Fri, 24 Jun 2022 08:04:55 +0000 (UTC) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3935C1126F8; Fri, 24 Jun 2022 08:04:53 +0000 (UTC) Received: by mail-ed1-x52b.google.com with SMTP id z11so2295779edp.9; 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=L5yGqzzqrexdqI+R/PrE1Mdxo3qJEBrMBxvOId5dYac=; b=ZFpcJ7bvOxDeoKsD9BSu/DxMgNBu0hFRZLpPD7H8Fycd+7tSFvQFmizj3ywr0jzQq1 RkmWSN6e5/pg9bL1XB9hzGeR8093OZYGPUC1VX+qdANm04kbOdINANUaSr8NgFtMu/Hg S45PN9KwSxrjbZrDs/0J9vao+7RX5SaEiDjzAEM/leu8JhfBoxI41HP181Zf6KMSE/Fm okg8/IZK989tO7X6nINgpZg+gCf89iLArC3DLvGvtKCEh5a3lg9AQAQTzCwnNJJjsuVY Qbpff4o19u7sF6PEYo7AgFemk0vj1/sz2hNghcnALHaM/9bNwI7G4YVqTXOgFT/zKotW 1lGw== 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=L5yGqzzqrexdqI+R/PrE1Mdxo3qJEBrMBxvOId5dYac=; b=7IFZKfLZdo7RF9j/6l4mRUKDNtNcHv3jM7jbdUlmcdWTWWl9DNFtZO7WVhJggjOl4Y jKPjQSTGtGjm9k19TtHmG5rAAKZayFfGcC021FIUyQXwRG2Tya43ytF9ih0RpSvgz9/N b5DauL/R+rJVYrNmgac4ZPTev/Hut3UE/fl1fCLaR6lKuvzu2r5yHjWz2sdvfFDdqill 3uaHrheLzuPFSttHq4gE/t5UwEPJ13wu9nsJL1SywyIZR8E1ai2fRWi+iREL2q9+QxKC 5BfBpQC3+NwhKLzhAGeXS00zDmx+V1qlMhXcWu5DXhsuPUP440Xc8JjLK/pnZViAkUwF 1QGQ== X-Gm-Message-State: AJIora+hXxTKVOdXl4xt9vnS2QXmg9Et4cunbmuPW2KrhWmAtktKmSOw PRKVWlvk80YwgtgndsMflwIXjC+1+nE= X-Google-Smtp-Source: AGRyM1v9WvX+EG4ooIeBZBCJi3ju+tuSkjouIG1NrE30YmCwfmias9TA1ULdOZTofk7OgF27mN/vJA== X-Received: by 2002:a50:ef0d:0:b0:435:6829:e980 with SMTP id m13-20020a50ef0d000000b004356829e980mr15867707eds.192.1656057891610; Fri, 24 Jun 2022 01:04:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:51 -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 Date: Fri, 24 Jun 2022 10:04:33 +0200 Message-Id: <20220624080444.7619-4-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 Subject: [Intel-gfx] [PATCH 03/14] proc: expose per file RSS X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Add the per file RSS to the memory management accounting. This allows to see the per file RSS in tools like top as well. Signed-off-by: Christian König --- fs/proc/array.c | 7 +++++-- fs/proc/internal.h | 3 ++- fs/proc/task_mmu.c | 6 ++++-- fs/proc/task_nommu.c | 3 ++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fs/proc/array.c b/fs/proc/array.c index eb815759842c..a3aabe4ac7c8 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -437,7 +437,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, task_state(m, ns, pid, task); if (mm) { - task_mem(m, mm); + task_mem(m, mm, task->files); task_core_dumping(m, task); task_thp_status(m, mm); mmput(mm); @@ -589,7 +589,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, seq_put_decimal_ull(m, " ", 0); seq_put_decimal_ull(m, " ", start_time); seq_put_decimal_ull(m, " ", vsize); - seq_put_decimal_ull(m, " ", mm ? get_mm_rss(mm) : 0); + seq_put_decimal_ull(m, " ", (mm ? get_mm_rss(mm) : 0) + + files_rss(task->files)); seq_put_decimal_ull(m, " ", rsslim); seq_put_decimal_ull(m, " ", mm ? (permitted ? mm->start_code : 1) : 0); seq_put_decimal_ull(m, " ", mm ? (permitted ? mm->end_code : 1) : 0); @@ -673,6 +674,8 @@ int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns, size = task_statm(mm, &shared, &text, &data, &resident); mmput(mm); + shared += files_rss(task->files); + /* * For quick read, open code by putting numbers directly * expected format is diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 06a80f78433d..1b123893f7ae 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -305,7 +305,8 @@ extern unsigned long task_vsize(struct mm_struct *); extern unsigned long task_statm(struct mm_struct *, unsigned long *, unsigned long *, unsigned long *, unsigned long *); -extern void task_mem(struct seq_file *, struct mm_struct *); +extern void task_mem(struct seq_file *, struct mm_struct *, + struct files_struct *); extern const struct dentry_operations proc_net_dentry_ops; static inline void pde_force_lookup(struct proc_dir_entry *pde) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 2d04e3470d4c..a4adc6fc13d3 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -28,13 +29,14 @@ #define SEQ_PUT_DEC(str, val) \ seq_put_decimal_ull_width(m, str, (val) << (PAGE_SHIFT-10), 8) -void task_mem(struct seq_file *m, struct mm_struct *mm) +void task_mem(struct seq_file *m, struct mm_struct *mm, + struct files_struct *files) { unsigned long text, lib, swap, anon, file, shmem; unsigned long hiwater_vm, total_vm, hiwater_rss, total_rss; anon = get_mm_counter(mm, MM_ANONPAGES); - file = get_mm_counter(mm, MM_FILEPAGES); + file = get_mm_counter(mm, MM_FILEPAGES) + files_rss(files); shmem = get_mm_counter(mm, MM_SHMEMPAGES); /* diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index a6d21fc0033c..5b6b9c5ed9ec 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c @@ -18,7 +18,8 @@ * each process that owns it. Non-shared memory is counted * accurately. */ -void task_mem(struct seq_file *m, struct mm_struct *mm) +void task_mem(struct seq_file *m, struct mm_struct *mm, + struct files_struct *files) { struct vm_area_struct *vma; struct vm_region *region; 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: 12894104 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7C6DCCA47E for ; Fri, 24 Jun 2022 08:05:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FBF31129C2; Fri, 24 Jun 2022 08:04:54 +0000 (UTC) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D24F112699; Fri, 24 Jun 2022 08:04:53 +0000 (UTC) Received: by mail-ed1-x531.google.com with SMTP id c13so2291698eds.10; 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=PzrOxAbYOx7ifGZKC2wU8owkx8EhW+dPG/cDbcyWkRRxFYxDiulGqnSaBZmUI95/QD 9QcyrIBEcX43dZyjallHfuvs3BG4C1Wy7hqLnPFjacVm9T/3vqA6WeoyIq6268XQeXs3 q2yZfy5DbWizUAR73Tv8qZ8rcV/6m2H7toSj9OY6zOIpDADmKR+SonHs+KaM9olliKZ0 vIxvY3wrvRfZZSQ1dibP5KfhxhIesNuDfKq7ROS5O97uPmlq3bbpfrV+zqh4x0PsVELb GIvHUx40dkqk4osB1HBoFRqQe8uaZNGHnCsfX4kA0u3APurfyU5lCn4ZHiHUhYTRcNTx qYCQ== X-Gm-Message-State: AJIora9S0LhmZrbtTdM67OPGA8MAoKLEt4xWP1RzPLotfdc695LmunRn grKMZlt5ndg8WdcF7THOiB8WB8eTlhc= 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 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 Subject: [Intel-gfx] [PATCH 04/14] mm: shmem: provide RSS for shmem files X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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:35 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: 12894107 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 643AFC43334 for ; Fri, 24 Jun 2022 08:05:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FBE6112C20; Fri, 24 Jun 2022 08:04:57 +0000 (UTC) Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CB2F112C01; Fri, 24 Jun 2022 08:04:55 +0000 (UTC) Received: by mail-ed1-x52c.google.com with SMTP id c65so2327040edf.4; 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=SN2tXnkiXYHDkRcNluGEiWD+Zcie7EgTba4v+LS00Rw=; b=CjcSe9wc4EjfAkbjkiF8NJM6p2V4TBIzx/MVoQMmpgiPsjLyR+gRuRTFEYB3Ktsmj6 uDAJoHxOnz8/QuPN6vTSy5gLwbvZIrxGeq6qoPabZTcRU6gXi4B9UgKRuVNDxdOuXcL1 cxd/73iXXQR+fr9ZjFoDFmjR0cLQM1R0DIR2jGAJPqHq78r8H+21zwbEgz340DrDdfqf X5N2BIdOCyjdEdUdAOIQhfOYFDl6u7OALHxEmKZyWH8er7gOe7gpZJPRqEWHVjjT+Zda LFVWx/ojsAy6fLSK9XLReier7Yc/aQFSo1vJ6Ffb4pLtiw1aDQ3/hGk/ftltPnqcfrJN mArQ== 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=SN2tXnkiXYHDkRcNluGEiWD+Zcie7EgTba4v+LS00Rw=; b=5Ll1rqaRGm/BqcPT412mRHi/Ul+Jvuv+QpezTWS6327qxyounJmaaHjSRsh25xldvO 2MKm8zkxl91YUeFExgEgmy1jS3C+ULGKtUWXXtn8cKcxzQeWPiOMk6VavWD7JCopvurZ RhaOoo1sW0D3YZkNTN33DwFBGZnKcRyWQW0nGudtDcgatpdLyA8AZRSXav0wufw3OKER L+ITsZZ4O11rlsKjoMH77XKVLCtQnfCmtuDKfy/H+VcCIepUq6G562Rw9Ui4MLcufBey takSjBPWU8/9szDRlprI2P+jr6vB/SHwTulcKQyCsca/M/c8N07mkPIrTEodurLI1WJp /l5Q== X-Gm-Message-State: AJIora/vqu+lroBz44Qis/YOJRvRVyAspEIS4z+QaeLyZAEfTTttAvWq 9CcCNlnXlt6PFG7V1l73sNVOUUGLwi0= X-Google-Smtp-Source: AGRyM1tBvj71cbsgZ5j4wXJcKfxDt7AmGXAvH0woqtRU4by1QVnuj6MIlbtq+6gf5TBsdwCsD9lmDQ== X-Received: by 2002:aa7:d296:0:b0:435:7f33:38bc with SMTP id w22-20020aa7d296000000b004357f3338bcmr15804834edq.399.1656057893977; Fri, 24 Jun 2022 01:04:53 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:53 -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 Date: Fri, 24 Jun 2022 10:04:35 +0200 Message-Id: <20220624080444.7619-6-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 Subject: [Intel-gfx] [PATCH 05/14] dma-buf: provide file RSS for DMA-buf files X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Just return the size of the DMA-buf in pages since pages allocated or mapped through DMA-bufs are usually not accounted elsewhere. Signed-off-by: Christian König --- drivers/dma-buf/dma-buf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 630133284e2b..16162ec3538c 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -494,6 +494,11 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file) spin_unlock(&dmabuf->name_lock); } +static long dma_buf_file_rss(struct file *file) +{ + return i_size_read(file_inode(file)) >> PAGE_SHIFT; +} + static const struct file_operations dma_buf_fops = { .release = dma_buf_file_release, .mmap = dma_buf_mmap_internal, @@ -502,6 +507,7 @@ static const struct file_operations dma_buf_fops = { .unlocked_ioctl = dma_buf_ioctl, .compat_ioctl = compat_ptr_ioctl, .show_fdinfo = dma_buf_show_fdinfo, + .file_rss = dma_buf_file_rss, }; /* 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: 12894109 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C6B3CCA473 for ; Fri, 24 Jun 2022 08:05:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3832E112C1E; Fri, 24 Jun 2022 08:05:00 +0000 (UTC) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 28144112C23; Fri, 24 Jun 2022 08:04:57 +0000 (UTC) Received: by mail-ed1-x52d.google.com with SMTP id z19so2278930edb.11; 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=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=R4Q7C94+9yywfvHJypZbyKQCgM1qSImkSmoedDisw3KdTJ/Q/VIShm7G4a4GONGEzS DYKmMHev6nXVpEP/skQLY0T+OfbvgO8W/NTZsxHXqSf0H4MfXlD9fDybLzfmR0hWCEGC 5cBoRZTG7VtTrchOLkNGiKYaEi5ptbwOmA1Ec83eDg/lIh7sF3lQ1E8RN9MhV5RLKdeS wLuZ+tq+q203Syxpo/CKvrAmI5qXVOCnMFHH8QXlPOVrHVBHLZayT31QWEdy7n4pUTGT YYBPAqq454NqBxm0vS2nFEO26T/LISG6TM0So3DEbzgdtkkI7UFEExCVHLfly98LpxEt i/6Q== X-Gm-Message-State: AJIora/JR/TNvIqdJgC8uKAjJdT30O1WYd/OHV6Ppz3Fy7w/30EvXDHx W9rWQJpggwOb4ReJaOf4wAc= 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 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 Subject: [Intel-gfx] [PATCH 06/14] drm/gem: adjust per file RSS on handling buffers X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Grodzovsky , mhocko@suse.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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:37 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: 12894108 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E43DCCA47F for ; Fri, 24 Jun 2022 08:05:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43263112C24; Fri, 24 Jun 2022 08:05:00 +0000 (UTC) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by gabe.freedesktop.org (Postfix) with ESMTPS id CFEC2112C01; Fri, 24 Jun 2022 08:04:57 +0000 (UTC) Received: by mail-ed1-x531.google.com with SMTP id z19so2279007edb.11; 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=ID2laRfYSApmjGzin/c5O7ZzYP1tMI9ua34YWk456Wk=; b=U7uY3MsA0DHippF6S8UKVRKmsJnNzZVtyS/oxSk8mnuxYbuH6lVcfrpX+0QqNbAzsr OHPqC1A2CJXe90yHB7/dZKLeRQkrpAbVd3R0tfpASOsFiFVpqjxyZSja4Ln6UQfGkV1F vEhUaLJqQTsf0mDlK6LHd6b+sDgfx27xoxB1E1JLj9lewb9qKNqcQpOqIQ9VN902Eeco K9AuesVMeK0hPkCglbUSWjfKsjVujF7T8cb3mCE5ZaCnxoDqUl7F2zCL64/5pa0gH7B9 1NKNHVz889djG0KWGG8iwf1I/ljLUIKtvBLVbUBVPCkEvOT+MIVlMWKc5SSwZwD6KAKU AbXA== 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=ID2laRfYSApmjGzin/c5O7ZzYP1tMI9ua34YWk456Wk=; b=WcPYqiKraWHqQM60SEvo+WiHHAfv+0i8yUB69s+O/9t68FzKVO2BsD1o50LrbCy48I VZpMzFyBnXm+REzoqb6Q+J8CAYewa2DArI/XAjFLbnDQrncHnBxrurBDB6J0ODHe2Qst /qzJY+RIRDyaVYbPb1rA2FdByNyy4B2isfUg5JLsG02SqJNpmppnK07q70iNpNkKK811 iudtyxPHV6w0/Jua45AiGpb+zfsVc2w3pEzFFCDk5X2VISao0JDtbT4VNW1PTZ99qeVO ck8tdDTQBEgCb8r2+6bBaFElMTBmoW8xDPmagYgXFWVJh5K0bRuvrT/4KvgFh45o3w8g twyw== X-Gm-Message-State: AJIora+naXhwWJi9NmOtUFeuItrbnez2He26bHEPlfnxopA67Htscwdn ctd2iZ4SSWxbgJwGdPgWx1M= X-Google-Smtp-Source: AGRyM1vXothqzNCeq2wfXu0Iy7pDBGR1100k8JOpLZpuKKiLhk+9M6Fn95/BBmkDNLC1mjmi1D/X+w== X-Received: by 2002:a05:6402:11d1:b0:435:d76d:f985 with SMTP id j17-20020a05640211d100b00435d76df985mr7954996edw.8.1656057896438; Fri, 24 Jun 2022 01:04:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:56 -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 Date: Fri, 24 Jun 2022 10:04:37 +0200 Message-Id: <20220624080444.7619-8-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 Subject: [Intel-gfx] [PATCH 07/14] drm/gma500: use drm_file_rss X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This allows the OOM killer to make a better decision which process to reap. Signed-off-by: Christian König --- drivers/gpu/drm/gma500/psb_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index 1d8744f3e702..92c005aa6e9e 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -513,6 +513,7 @@ static const struct file_operations psb_gem_fops = { .mmap = drm_gem_mmap, .poll = drm_poll, .read = drm_read, + .file_rss = drm_file_rss, }; static const struct drm_driver driver = { 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: 12894110 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B22D0C433EF for ; Fri, 24 Jun 2022 08:05:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A993C112C4A; Fri, 24 Jun 2022 08:05:01 +0000 (UTC) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1141F112C27; Fri, 24 Jun 2022 08:04:59 +0000 (UTC) Received: by mail-ed1-x52a.google.com with SMTP id eo8so2392621edb.0; Fri, 24 Jun 2022 01:04:58 -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=VNqcNj6revDChOlzSUl5dI/bQxdNazVE7lZDbJT0lrG0nmipXLYL04TVfqG2Pk0633 cPAj304GX8KxraCuTt6uAR+Yw9MD55B9sweBfoe0nC9yq87Qml8w12ojdZwseWEg6jbE Lr0mRLKBIfdnNVdO4nYXH4eP9d+ql+dYj6qI3MLIlmGg6a+YMYp+aDPjN77acUTd6JJy h+5roHsZzjuHuMVSN6ui9kE6PB8uQ9Pqbm18iFmKhprUNJG7W1l7tOCF0PKQTFHlbzay 5zOZSmDzmXBrXh6kDNnAlxk49Rb1b/ESAoagvnECD0tiPBUuuLNRvUsz7VzfLbw0lpBl gmIw== X-Gm-Message-State: AJIora83xkXYw8AR4yN19MR0+oNEvV/1x0dCP4urLRYJRrAPybfkDqXQ LTTLObJNXD0SwcaYDSimTGk= 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 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 Subject: [Intel-gfx] [PATCH 08/14] drm/amdgpu: use drm_file_rss X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Grodzovsky , mhocko@suse.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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: 12894111 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 872DFC433EF for ; Fri, 24 Jun 2022 08:05:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D358A112C5B; Fri, 24 Jun 2022 08:05:02 +0000 (UTC) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by gabe.freedesktop.org (Postfix) with ESMTPS id 36717112C32; Fri, 24 Jun 2022 08:04:59 +0000 (UTC) Received: by mail-ed1-x529.google.com with SMTP id cf14so2302222edb.8; Fri, 24 Jun 2022 01:04:59 -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=dAm9Wx3E/hIHI8Wkamz81abKilVaRnrIwXLIqGJ2uAQcZJqcIWg3B79jsBlB81sNwh w1XqegTv5kpraU/fdBbsKKqzVpS2tmqyRUxBrKeRbfQvMjktJzaAfEMyMhiHUxXAAhOu MwQ/QOQPhiT3kHZkSLsq6fTVWLenQIuo+4c3VrP05qC1HwVbJGjkYJfQkl1jzveCpl/b WS1GIbomXZhzXmPzM+xQ3Stxiy8vns6uB6ySoWViUvS+fVuP+V/mYYUDbVmMmX1ft/FQ m1fTq4HsvMNGH4xvsLiLxhOMDuM8+N1GI44k0bkDlV8ECjLQtCDaSRDk3bqNg0jYSm0j n9DQ== X-Gm-Message-State: AJIora8e3TBxZJz8VhYumGTxICOzBimCN0XHlv5TBhNfIrU3S1C2vO+B ObniCGBTHWEJlErSHZwb8do= 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 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 Subject: [Intel-gfx] [PATCH 09/14] drm/radeon: use drm_oom_badness X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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:40 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: 12894112 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 979A8C433EF for ; Fri, 24 Jun 2022 08:05:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 64923112C54; Fri, 24 Jun 2022 08:05:06 +0000 (UTC) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6BF0D112C32; Fri, 24 Jun 2022 08:05:00 +0000 (UTC) Received: by mail-ed1-x535.google.com with SMTP id z11so2295706edp.9; 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=m/E6hWEFQyi25CxFeEuPVoEVkNjsUA/fW4bkRRrhTG8=; b=e8Okw9V9KyZY0LQ9UKvtkO1+tj9txF7SZgjxfu0nIPVJ7UHFSFPajh1LcrrR+mc/Ax 7Xcml0b3DTzx3T2bMsv8lp7T6q7E8SECtadIf2BbI5ZWp1CKCCjXMJ+X+N3gB+Fbk+hI b31Ng6R/qrQ8N6LOuGNRH4RuKGuBjnKOVPxxK7EXBtqVHECTyUdENgmbiNMStYeqtDEf i8j/Pv/qCpjDot+5YbNEf4ExwNPa/ehQnPHUm9ruLn2IZbJZpd2tKFDQwHw3MDtpAITE BVAJdg6xrEucAqwIZovpm02Nb/tWQUOGD/LUv75bzOhZfpRKGHx3/vDdg1//bFowy+2C xUAQ== 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=m/E6hWEFQyi25CxFeEuPVoEVkNjsUA/fW4bkRRrhTG8=; b=V2OIiPILrOMzPHb1ieV7zDC9fWhXuRJrnNeW2ZIaCoPVToDxonmtZoJHj3hx2jZHuv es2bK6aVbp38Y522t4bnb10ewvuusyMRke8rpbu4wNi9TyC2XApKDROCHBCDIcY1wM33 8Q5I2jt4ANBITAEDZJXiRxQStDNjr3ykqj5YPP5WpzJyKjWEav0SeoRdK6wGgndPkdnX 4SAgadwABWrlvS2rSJwyAHK0Kc5WwPBqenaTwDXjk1cU6O3omXgFLfELhNIppJmyZv89 vpnkmgNFNxfteVEF17/8Tb9rajBZRP4BNjVi0PvVOIAOQO9Wfa48l3KmHvDZxDLEBNvo xoww== X-Gm-Message-State: AJIora+oeewPn84xIVLvGlUGvb2cQ0K1CSzp36A0KGfAH5UkJt722FN/ wEbXWNuOcTgKar056FTFdy4= X-Google-Smtp-Source: AGRyM1sPm1PtPb+HeXcaBFnsmjeMMONuCGOa4UKNnvwqlpKNsvibmM7CXbEqPCXHhwwP42+MiDXxcw== X-Received: by 2002:a05:6402:5c9:b0:420:aac6:257b with SMTP id n9-20020a05640205c900b00420aac6257bmr15655024edx.128.1656057900060; Fri, 24 Jun 2022 01:05:00 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:59 -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 Date: Fri, 24 Jun 2022 10:04:40 +0200 Message-Id: <20220624080444.7619-11-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 Subject: [Intel-gfx] [PATCH 10/14] drm/i915: use drm_file_rss X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This allows the OOM killer to make a better decision which process to reap. Signed-off-by: Christian König --- drivers/gpu/drm/i915/i915_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c index 90b0ce5051af..fc269055a07c 100644 --- a/drivers/gpu/drm/i915/i915_driver.c +++ b/drivers/gpu/drm/i915/i915_driver.c @@ -1741,6 +1741,7 @@ static const struct file_operations i915_driver_fops = { #ifdef CONFIG_PROC_FS .show_fdinfo = i915_drm_client_fdinfo, #endif + .file_rss = drm_file_rss, }; static int From patchwork Fri Jun 24 08:04:41 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: 12894115 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66743C433EF for ; Fri, 24 Jun 2022 08:05:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E267112C4F; Fri, 24 Jun 2022 08:05:09 +0000 (UTC) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by gabe.freedesktop.org (Postfix) with ESMTPS id BB152112C57; Fri, 24 Jun 2022 08:05:02 +0000 (UTC) Received: by mail-ed1-x530.google.com with SMTP id e40so2342159eda.2; Fri, 24 Jun 2022 01:05:02 -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=TEEoP8KCSv5pjlxAC2eGIjep+gJf30N0QWrbUiAblRs=; b=NsqpIeUqz6z1oXfKvdYH1/TqTFTXK9j1sJxHR/6+teGsI6wAcS38sTUENz1r/j+qWB Zx5BEXmUAQRLHC+0/WMd5cHg7pqTjt2mJsun4y65v/FkbkdUuEowB0Xeil8wiVIopW0C v7uFC+sCP7XMFz3Y74shfL8paThvoo6rqN5jyvJIG2lp6HaYqdHKi3OzUK5gdPk77trY JLyV0mg+oHiky3PUkntBd6bE+5pzI81H81uvLdg5+PBonm8eW64IOlBu28lZPhHT9xEL e7ST6iswEXQNp5oHPD8epprMYI811lDLgUfizTiIewMN4uvazsjzOwEcCSjRB0yo2rxG tMwA== 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=TEEoP8KCSv5pjlxAC2eGIjep+gJf30N0QWrbUiAblRs=; b=uo4BHFxKgjRqnaaOUfPgD7j/QKYp/ik6dmIWAzmjoCzpM3UcaJl2X8dxs7niQYszag boz3KkHdrBbnsbPh2OQ1s5cvpNArI0fdq4vjgASl2PlM9vZTBkglSQup6nb/9mWgBU1G ZOa+789EgXexLIUfks6lHxkYFhSg/AbXM/CQdT+ZnUD5yLYjvjag4hAMYGU0VHchySMa KLbMhvU3DSpV9cjoWF+q++J7ZGe0mpG+hFt1upQ9yuDqsgLLkiuLPrQLhzCt1C2vmzoU nXq9Z6ctwQNLRNk0bH1QiDsrKYi7MLYAg7JEHC6p3Fbku2TN+AczU87PRYaUp28zbrni 0YXQ== X-Gm-Message-State: AJIora/PgmsH+hs4+0J0clJAx6W/5fNG9ZTBq23Mh2iI0zeviFa3XfU1 ypsLIRZkM3JuJRCH8AnxQJI= X-Google-Smtp-Source: AGRyM1s12FOWdmvVSggeHhbhrd16lE3/DoVEUD/LwuW4RhCc+Y/hP3ZDhy6clyaoJ7ITIboMGB65hA== X-Received: by 2002:aa7:c952:0:b0:434:edcc:f247 with SMTP id h18-20020aa7c952000000b00434edccf247mr15543375edt.412.1656057901251; Fri, 24 Jun 2022 01:05:01 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:05:00 -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 Date: Fri, 24 Jun 2022 10:04:41 +0200 Message-Id: <20220624080444.7619-12-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 Subject: [Intel-gfx] [PATCH 11/14] drm/nouveau: use drm_file_rss X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This allows the OOM killer to make a better decision which process to reap. Signed-off-by: Christian König --- drivers/gpu/drm/nouveau/nouveau_drm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 561309d447e0..cc0ac7b059fe 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -1218,6 +1218,7 @@ nouveau_driver_fops = { .compat_ioctl = nouveau_compat_ioctl, #endif .llseek = noop_llseek, + .file_rss = drm_file_rss, }; static struct drm_driver 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: 12894113 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CEC61CCA473 for ; Fri, 24 Jun 2022 08:05:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 11651112C48; Fri, 24 Jun 2022 08:05:08 +0000 (UTC) Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by gabe.freedesktop.org (Postfix) with ESMTPS id C25EB112C48; Fri, 24 Jun 2022 08:05:04 +0000 (UTC) Received: by mail-ej1-x635.google.com with SMTP id g26so3093829ejb.5; Fri, 24 Jun 2022 01:05:04 -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=mvZm3GOb/7rXSxkshdTF2wepUBK3UtFzbE2DPHl7Gd1PLanjyTdTDKLgX7KidPghLR SFJVfWiTUaUljo+5FG1Fu6pB5wxRIhgIchHQ629htyJE1unROwTu7gzlwIEH6lzUwQxD b80yZ3oATnqh2Jv/DkbBs6ZffAb0hdu4ZPUmr3nFqe56vjqpx5Pmb/7Ri+DWIf+OypCy D4aPdT6BN2pHvoM8EMC8i+hncxrZ3VoyH10C4qsaSc2WBrGT1dLHs6500IK5SNqAZDaV VZYtrkvu6Dr6sqKMKio8OorxCAmrfub9wuvkX8Ey6u79TGq5gE0bifTBlRWHQkhazXEM gDEQ== X-Gm-Message-State: AJIora+9/O+7163ttNbO9m2DBBuHucMh22xuDacmIHVwTFY2rn4Gk/o5 R/gYWt6kFKNIa75r+UNb7mXKl2ljLsY= 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 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 Subject: [Intel-gfx] [PATCH 12/14] drm/omap: use drm_file_rss X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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:43 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: 12894114 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AD48CCA47F for ; Fri, 24 Jun 2022 08:05:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4CDC8112C09; Fri, 24 Jun 2022 08:05:09 +0000 (UTC) Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7348B112C27; Fri, 24 Jun 2022 08:05:05 +0000 (UTC) Received: by mail-ej1-x62c.google.com with SMTP id h23so3028733ejj.12; Fri, 24 Jun 2022 01:05:05 -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=zYeizJ3QsvNICXqczpSXbVJYn4Q15WJ3kWZARt06sMw=; b=J/wgCdTYLso/wR3DyIMcpoWNVTSy/cjwLHx9Q39+E1ZodWxIhAlJ61DCaVuR1rD/f1 pY38NwP9kY3Plwb6iN8EMe8/vG9qymIkGWF2JCZ+R7/X1R4EnwTmpYPULDKENIe2Fh6w FQCJsTwM3UQu3vJZESwvyK8+QhBWg7q572dTWiwHnN2NLv3ZwrQIiyW3sjqRVSC1nkgR oPerAY9zKue3qqTiHQ2r5ixckyjq8LP76+lkRLuVQapgOCZ4X7rOOw4Ml4021WrsttG3 2MNeb6ISLKoiQ0jg06LSWwnAoniobzMHdFdZQd7CD+Jp+dZlI40apQN+4mRvkiBAtwMN +2hw== 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=zYeizJ3QsvNICXqczpSXbVJYn4Q15WJ3kWZARt06sMw=; b=pvR+X3MU3VlMwd3cxrWWEbzqtu74fi+sl2GuxY4mBrksN12a6JjGWQAtCNn4Is2dtP ctMc5rTOMFM2Y2w+tThGevxM/QJ9T4sO6DWYo2gu0a70Zno8TJqApKTHhHEozGMWwtaF +ZMGJuQMcUkFm+2LdQznheI8hAJU5JWK9K/NJ5TDoriuACs759/hdvODLwx0glq9UPMY BzXI0h5Kr/q7M2qxGidiZIATkYUPCBvSWucxDMIGNJlGiwDiLZ3KIuPyNabwBeGQxBK5 WCe4GCBfdQxJteMNVsv1+raYUIC5dn6AsrSY5HM5nqdoc1IBOS3TUHL/3WDt7oiE9MtQ jBxQ== X-Gm-Message-State: AJIora8Ge+wJGr6We/LdJMT6BsSLP7UtCSFgqas/a5BG/cZyDjbYvojd zXGRRPYKi1AoP7HWViaDSIE= X-Google-Smtp-Source: AGRyM1uXEIqId7b73deRFKUwrzmvPTkFA55neIHh4LETAN1AX61HEKuXSB8HtzpeXXBy1GfUk1mJtQ== X-Received: by 2002:a17:906:ee1:b0:70d:d293:7b30 with SMTP id x1-20020a1709060ee100b0070dd2937b30mr11782721eji.134.1656057903826; Fri, 24 Jun 2022 01:05:03 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:05:03 -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 Date: Fri, 24 Jun 2022 10:04:43 +0200 Message-Id: <20220624080444.7619-14-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 Subject: [Intel-gfx] [PATCH 13/14] drm/vmwgfx: use drm_file_rss X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This allows the OOM killer to make a better decision which process to reap. Signed-off-by: Christian König --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 01a5b47e95f9..99bf405d31b9 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -1577,6 +1577,7 @@ static const struct file_operations vmwgfx_driver_fops = { #endif .llseek = noop_llseek, .get_unmapped_area = vmw_get_unmapped_area, + .file_rss = drm_file_rss, }; static const struct drm_driver 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: 12894116 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C803C433EF for ; Fri, 24 Jun 2022 08:05:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7459112C73; Fri, 24 Jun 2022 08:05:10 +0000 (UTC) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8BF0A112C5E; Fri, 24 Jun 2022 08:05:06 +0000 (UTC) Received: by mail-ej1-x62d.google.com with SMTP id fi2so3060985ejb.9; 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=gKgAs0xxLorEXtWpIPNdRZURm1HOtIu9/K+Xkr5v4RTiEfXEas1m+J3rW4a2DbjvvB NwdY4/noDeiEKjb42gHOYb5VBVH2ZLlPSHxPsMxiOws76uexLDwooYv8upfuEOxNyOMR T+6x8oC5dMkXyTfvQTtrpOLao6UlDUUHjUy9bhkkSgfmYhqvLA5Un8A6mkiZ6nN/r1cZ Tao0RdS+cTTSlkF3f5FOH027k/+jdQVQJtdWuFjIEEXCBSJroTR7hzO07Os82GRMeKT/ 3bSKF4K9uC69uiGmmdBJywkpraIOa54im92H4Pw44rewskEZGhagpIRclOX9fGQCBqve ExRQ== X-Gm-Message-State: AJIora9F1/NJQnW2pAh4ylCHWPvHfe3HX95zDxGFE0fXNzOjGAGEqJEq stS6WJLO3MHESEbN/s3CgRY= 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 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 Subject: [Intel-gfx] [PATCH 14/14] drm/tegra: use drm_file_rss X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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)