From patchwork Tue May 31 09:59:55 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: 12865220 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 D5FFEC4167B for ; Tue, 31 May 2022 10:00:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245413AbiEaKAR (ORCPT ); Tue, 31 May 2022 06:00:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245390AbiEaKAO (ORCPT ); Tue, 31 May 2022 06:00:14 -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 DE39682172; Tue, 31 May 2022 03:00:13 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id wh22so25593194ejb.7; Tue, 31 May 2022 03:00:13 -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=s/d7KhR0z000Hs/IA+QwE65RKZidQwaLcmmsuNIx8Rk=; b=jlmbD0lwi6rUzLqjCUjXO1DNk/hQQjjKuOHlr6e8k22ViZDgKVzUz93W5EYx10np0/ Xh2ALDpQ6yIyeIe45k8a2sJl4amrOM+41IYI/txxFcT5UiQiv8db1GOFm4nHNEit2nsT t6Lk/Ru1k3XgR2+zaythLqoBQNPWx0Sq35QwntG6y1Dagw4XSMLJoD/MgsY7xDjJfu0E RDqGAq6AuvEeKHy4q+b3C0gubIRXhKGHY2dodSyKGXyL5yGmdZeVPY58oq3Uvft0jR6c xVeACw7Idp6VxMTOsOvsq4Sy7+v2x6+Yzp3O+8Z7K9aogRlAi/UblC7icee5ruMftqkd rgVw== 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=s/d7KhR0z000Hs/IA+QwE65RKZidQwaLcmmsuNIx8Rk=; b=u47bou2MSfYPwxeW8YW0TkiX6HUA8TA8YI7++5N3En49HffsuAFkr1Merkv28FTVyd eULoiFPy+7MxTsEg4935/+8rT1n98/otIEgG+C7+8RFZFUxKXpY4Gb79KZCpbl05vicY KMCrEoJxB0swc5vOC/IpQMMycp/PQXZawJocIoNCkxLT0KnHwqP86HjpS5mt9VptbSZ6 MGuaNTsnK0EyvBjUzRvPJ0rprqQ6HbBUDhYz1QSNHuTKWEe19KUxGUpE0gLheYj7s4bQ +xSH4CxfVPutVDTIDF6QuGG5IlwWqpb/181aN3JyOOyxK0eQNRDVs4IdundU2GZxMhtz tWug== X-Gm-Message-State: AOAM531Ytxi6chJGAN7tPJFmeBSF7oTfh4ZRTBOoXsdivCKgDWxJRpvF cmF+JiEZGfWd5qeoA19hZWmXgd7iFwY= X-Google-Smtp-Source: ABdhPJyprdDlfIYDCtP3JSXlPBRA6lpUaNM/DoimNqu/NR7jJ7DMpCFACqCWHS14mUBV5Y9XUPfxDg== X-Received: by 2002:a17:907:9483:b0:6ff:b1:467a with SMTP id dm3-20020a170907948300b006ff00b1467amr31727121ejc.683.1653991211970; Tue, 31 May 2022 03:00:11 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:11 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 01/13] fs: add OOM badness callback to file_operatrations struct Date: Tue, 31 May 2022 11:59:55 +0200 Message-Id: <20220531100007.174649-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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 file_operation implementations to specify an additional badness for the OOM killer when they allocate memory on behalf of userspace. This badness is per file because file descriptor and therefor the reference to the allocated memory can migrate between processes. For easy debugging this also adds printing of the per file oom badness to fdinfo inside procfs. Signed-off-by: Andrey Grodzovsky Signed-off-by: Christian König --- fs/proc/fd.c | 4 ++++ include/linux/fs.h | 1 + 2 files changed, 5 insertions(+) diff --git a/fs/proc/fd.c b/fs/proc/fd.c index 172c86270b31..d1905c05cb3a 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c @@ -59,6 +59,10 @@ 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->oom_badness) + seq_printf(m, "oom_badness:\t%lu\n", + file->f_op->oom_badness(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/fs.h b/include/linux/fs.h index bbde95387a23..d5222543aeb0 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1995,6 +1995,7 @@ struct file_operations { struct file *file_out, loff_t pos_out, loff_t len, unsigned int remap_flags); int (*fadvise)(struct file *, loff_t, loff_t, int); + long (*oom_badness)(struct file *); } __randomize_layout; struct inode_operations { From patchwork Tue May 31 09:59:56 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: 12865221 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 EF2BEC4167B for ; Tue, 31 May 2022 10:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245423AbiEaKAT (ORCPT ); Tue, 31 May 2022 06:00:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245405AbiEaKAP (ORCPT ); Tue, 31 May 2022 06:00:15 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB26482170; Tue, 31 May 2022 03:00:14 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id h11so16770606eda.8; Tue, 31 May 2022 03:00:14 -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=SljQJAeVhGKeIBI51MbYTdJihy0sRNkihcgcWrQIyMk=; b=ZBp9EWdv4dyFa/WsIYerVBV/5Czl1dSOQzB0bWaLR8VuemQ6QOm1M4R69eKpHA9nd6 c1HPF6oYuRRxZPShB/rzFxpDYr2SzpVcfmaTTI1/AsPIJMT2sPHv14VCM3Ka5VBHYXAs x+RhdpJZ93axyquUdQTI8BbhfGTHEGOHs1mum12ZFtPHB/T1dEkf20VpzDu5c8o8JJxt L5805s8can7oaGbMP04m/NeJEPnJ5J3kmnPoXDsme1EeBIo1b0t4i/Kl8NIO/OOcqJec 9FKHHAZGXXE+S9p7n7ifDG4TYZso+CBFSqXccDBgxGoDfbZX1IAhrrimZdFs69Jaqd2K a48g== 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=SljQJAeVhGKeIBI51MbYTdJihy0sRNkihcgcWrQIyMk=; b=bIK/EBT9ZWRmBQZ1y5/uAXQZk3JD7K98FWmLdZCgazPPvb0DbfH2gHX3hHejGVWY16 A1Sm29RQo5EgZ+K5YQc2YZOkfNsAeV83zjUg5IEI44A7Jr8XxSE8FYhOmOWFzFWfOx1l VH+WKtxWfrSD9OKrHyYryG8ZWj3D0eICDCufPo4H26HN5dZbjQFDBVSibwQg9DAGWBzC j92rCISMcTjVyMxuEMqBtG46pWTyrXBxLmIlVsZlgH8+Wte6PFd8U5vBbgttRzdaJ63w zUNTYDawHw1vUPIk+YaVH+AmSekiU3B5lWo0oO/Zj/bUw4b18iuzihUim/702ixGmkjc DlYQ== X-Gm-Message-State: AOAM532J04tPSt+eeGIqlsvrdV94J54m7QWlBOQ4ogtUCrtp2btAQ1I7 CItAg0e1kpNq5fVWCfPFq0MHj2vysV3O0w== X-Google-Smtp-Source: ABdhPJyZPq+OysWRAlAZamevHlLGk4fQamGD+X1EEEY6OJezkY6NR4XeOrBHuCnsv4+0HlBYkj/10Q== X-Received: by 2002:a05:6402:34d4:b0:42b:35e5:fc78 with SMTP id w20-20020a05640234d400b0042b35e5fc78mr53286582edc.372.1653991213421; Tue, 31 May 2022 03:00:13 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:13 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 02/13] oom: take per file badness into account Date: Tue, 31 May 2022 11:59:56 +0200 Message-Id: <20220531100007.174649-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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 OOM badness. For this the per file oom badness is queried from every file which supports that and divided by the number of references to that file structure. Signed-off-by: Andrey Grodzovsky --- mm/oom_kill.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 49d7df39b02d..8a4d05e9568b 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -52,6 +52,8 @@ #define CREATE_TRACE_POINTS #include +#include + int sysctl_panic_on_oom; int sysctl_oom_kill_allocating_task; int sysctl_oom_dump_tasks = 1; @@ -189,6 +191,19 @@ static bool should_dump_unreclaim_slab(void) return (global_node_page_state_pages(NR_SLAB_UNRECLAIMABLE_B) > nr_lru); } +/* Sumup how much resources are bound by files opened. */ +static int oom_file_badness(const void *points, struct file *file, unsigned n) +{ + long badness; + + if (!file->f_op->oom_badness) + return 0; + + badness = file->f_op->oom_badness(file); + *((long *)points) += DIV_ROUND_UP(badness, file_count(file)); + return 0; +} + /** * oom_badness - heuristic function to determine which candidate task to kill * @p: task struct of which task we should calculate @@ -229,6 +244,12 @@ long oom_badness(struct task_struct *p, unsigned long totalpages) */ points = get_mm_rss(p->mm) + get_mm_counter(p->mm, MM_SWAPENTS) + mm_pgtables_bytes(p->mm) / PAGE_SIZE; + + /* + * Add how much memory a task uses in opened files, e.g. device drivers. + */ + iterate_fd(p->files, 0, oom_file_badness, &points); + task_unlock(p); /* Normalize to oom_score_adj units */ From patchwork Tue May 31 09:59:57 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: 12865222 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 0616BC433EF for ; Tue, 31 May 2022 10:00:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245434AbiEaKA0 (ORCPT ); Tue, 31 May 2022 06:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245410AbiEaKAR (ORCPT ); Tue, 31 May 2022 06:00:17 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4341782170; Tue, 31 May 2022 03:00:16 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id v25so8726073eda.6; Tue, 31 May 2022 03:00:16 -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=mIxGnBiNQH7wWhpTAOYvfGm3yBUdW2Lv8hSFkOKs0aA=; b=YDb0d+PyOKs210qCqYAFGBvUZTTS4RAIRhhK/d+QO9gshGdaDWgKspQVMQpG7nrtX+ TufVc/6A+Te4bjWf9pWyv6ntrZjNTvO1o8tYpzOoAdjIqo9Bklfzy8dXk7BYMrxpSM95 usfHUfKLh7JEKoG9wN5zLAoQm71wvfUxu+xCGMzIBHPjTBYFFRg/fQ8Bc1mbpWvV9bwY PR/pdpoW3OmlfWODJKjL9jIEkGs8hD/ZjjXmxLFGR2b/njvlb082VeR+rrGF1R55oj4p qQAdYumTKMLx79UKpj8YkktDQvBcFKlZvP9zcVhZ48lAtSdY31sMnKI1F4yE0kXKaL3w HsZw== 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=mIxGnBiNQH7wWhpTAOYvfGm3yBUdW2Lv8hSFkOKs0aA=; b=EzU/VTjDPqbd6mX5MnUJBZf5dPyBbmugrc/qa0bl+TwK43Qf7AD99U0bvcESR6zR7i 3uBLQU3dbVVm93HWnv8zNa6vg6WguSKa5Un9bCuy7dKs0HNmRzCbUEBMujEN1j7Ldd2q LTrUSQlTbvSldcKsL1Rw7lXSyxm/gy5ekjfZY5ZE1FH6IwCGWX+Va7+Tmhh2e0NiVbOz XEq+YQfaTbFCdPfOKoUMEiYwfKiwORZ+hFuE28k4dzcrKMwjJl4QTwnF2IVpf3aOS5A4 pgB22kveaeyPFoQZKeU/cuYogDzRX/UcPng8mYNfUE8j3BO2uPFe51bFVY/ykvKE//5T K6RA== X-Gm-Message-State: AOAM532YkWiHHg3W2caL6K9FJxax7zUFkECOtG86b0yNgY43FdMTcjqX tlWMlvEhHfSGl4LhnsYPMCrTQysD1KyrYQ== X-Google-Smtp-Source: ABdhPJym6XbAZzn9cN4OBs65hCeI931sSsPopVK1yV+b7qr9DjRRmdjRD8OGAyhyWkR+LhQlwkaGRQ== X-Received: by 2002:a50:8754:0:b0:42d:e92f:c924 with SMTP id 20-20020a508754000000b0042de92fc924mr902302edv.389.1653991214818; Tue, 31 May 2022 03:00:14 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:14 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 03/13] mm: shmem: provide oom badness for shmem files Date: Tue, 31 May 2022 11:59:57 +0200 Message-Id: <20220531100007.174649-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index 4b2fea33158e..a4ad92a16968 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2179,6 +2179,11 @@ unsigned long shmem_get_unmapped_area(struct file *file, return inflated_addr; } +static long shmem_oom_badness(struct file *file) +{ + return i_size_read(file_inode(file)) >> PAGE_SHIFT; +} + #ifdef CONFIG_NUMA static int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *mpol) { @@ -3780,6 +3785,7 @@ EXPORT_SYMBOL(shmem_aops); static const struct file_operations shmem_file_operations = { .mmap = shmem_mmap, .get_unmapped_area = shmem_get_unmapped_area, + .oom_badness = shmem_oom_badness, #ifdef CONFIG_TMPFS .llseek = shmem_file_llseek, .read_iter = shmem_file_read_iter, From patchwork Tue May 31 09:59:58 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: 12865223 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 8325CC35296 for ; Tue, 31 May 2022 10:00:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245463AbiEaKA3 (ORCPT ); Tue, 31 May 2022 06:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245419AbiEaKAT (ORCPT ); Tue, 31 May 2022 06:00:19 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9170282172; Tue, 31 May 2022 03:00:17 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id n10so25580324ejk.5; Tue, 31 May 2022 03:00:17 -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=Nne0qJckA/hMuSOr0O9+SBShBUR9gCrIksc3pugIfaw=; b=O04QHlDY6DBBsKrGQS2x+dxNPUvaLGwatBhA9Ypf6fUvXeQn4u2iZyLs+G4Gopi2gn lMPnA9p2Gz45t7ICtHVl6tg1eE8albLaPc/BmmQBPg3ZJxqBikRQy57f7Gd//Yisj1mq 76jYCx/vPIdNy0UXH2etO7PDMMWd1OqeisBEgyFTI9zNlOQxBgL6irhDuYoGR91FeUzH EGqVWW4gL9+MALPxEAxgJkeLA1KAldYG/7fZPitSHzltfhEhG1K7I0p/7oGL1xaLWwU1 IWCc36zCKbmVtfqPjeE1k5dNjDQMnB1bXMwDXVEhisX6bguza7GDvQPXMaO9uEGf9zR/ OIgw== 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=Nne0qJckA/hMuSOr0O9+SBShBUR9gCrIksc3pugIfaw=; b=YKY4kc4K9h88N6xlb2ExBoxaxveasYRFz+2xrYsGxYV+Xgck5RLQL3HMbf02oopUlu 9c4OsC862N9XSoU7+rcvEik7eGyTqELi6YsDG2UFC859tZ98evKBlQXD5qXyNLHN6+8X ZAUka2voptF66lrtZFpfD0yWS5rgT4ZOdy81KqJuSNS/46vIo4mXUjSYYRd3Kjeya//f tY29+u/8OTxPY1RYPRL+Br29ixVdZ9FZmqqKlZjR5TTCvDVEJpjbiotjTnDGMxZJHZ8I FkCvT3IeI4cOSJXllHvxedRguAtKARthjiw7mR82QdnpxWUt9o0+8ulDg8mMaY+gcuGr 73Ig== X-Gm-Message-State: AOAM531x4513CxI1N2RoS6rnHlA32wTcCHxZ9O6sdcWzTuuKwlmWdBQD MCs/5Mhdk8OYPNY8wcrh3IGMiOjNPMdcFA== X-Google-Smtp-Source: ABdhPJxmWnOcxxDaVC0tQGNbj0CSrxLQR0xy8ghD6daeqEn1NVbnq/aFqlXxIqVHd6RNxE0nHnKb2Q== X-Received: by 2002:a17:907:3f13:b0:6ff:18ad:6936 with SMTP id hq19-20020a1709073f1300b006ff18ad6936mr25394163ejc.158.1653991216188; Tue, 31 May 2022 03:00:16 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:15 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 04/13] dma-buf: provide oom badness for DMA-buf files Date: Tue, 31 May 2022 11:59:58 +0200 Message-Id: <20220531100007.174649-5-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org For now just return the size of the DMA-buf in pages as badness in the OOM situation. That should probably be extended to be in control of the exporter in the future. Signed-off-by: Christian König --- drivers/dma-buf/dma-buf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index a2f9a1815e38..bdd4e8767cd3 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -388,6 +388,12 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file) spin_unlock(&dmabuf->name_lock); } +static long dma_buf_oom_badness(struct file *file) +{ + /* TODO: This should probably be controlled by a flag */ + 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, @@ -396,6 +402,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, + .oom_badness = dma_buf_oom_badness, }; /* From patchwork Tue May 31 09:59:59 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: 12865225 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 81EE8C433F5 for ; Tue, 31 May 2022 10:00:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241101AbiEaKAb (ORCPT ); Tue, 31 May 2022 06:00:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245425AbiEaKAV (ORCPT ); Tue, 31 May 2022 06:00:21 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2972884A14; Tue, 31 May 2022 03:00:19 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id f21so25481616ejh.11; Tue, 31 May 2022 03:00:19 -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=TNC+q1HYAjRPp62MTH/zi2loKTLmxRGj7rz2onfHvYc=; b=GBXq9vHHCJxrvvL36ccyiGaBUxAA4gOuuAE6JJqw7rKR68K9hwr5XNyqXOEIIT7vcs b+n0Pi155O7ZJ3hNSKyRz9mXIkUEKm2lcFNblLxTflNcxgkeUjq/QrKdI4HYMHPMzWAq SVmk2ARrocIRZTeQ2RslzCLdsKehpXg+Kq0kTeKoNXvG6sD16XOQ01MvqTpq1vkjhPtq +sWJbuWYYHK+e5WSj+SIwpEX66Y+xGwye9J3sHcOAM1TU5DbXJA7e3WOh4GWP04ovYuJ BVp7Cx+40rXPVhuLagJwI31hssTpBLyHz/XRKyjdzt8EQGLbOfMOhG6RJdTATBNFmuK2 0Y5A== 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=TNC+q1HYAjRPp62MTH/zi2loKTLmxRGj7rz2onfHvYc=; b=uvVaBjCnioWLWAVLQvUWYntrPFExkrnD14h2h4bkKC8KoJQrXUHexMGfADheaxuI4J 62l1PPFu0QDc6FRw8bP/0jXAWet8XH28nTzfj3vdD6isN8Q4cGK/9rdTFvKMbUCzHzi9 KXkyAQcp+cdeUtc/d99oRcFYH15horqmhPF/knz9RkiJllGrada6z646Ee05dWlCrt6D LIMdCBff5sq8QkqENe3L1pEWC1aYPpAHQITyPw8VDajbEMI4SMHKPcksmY5ROWmCouqB 5ZzWOxPGKHo1odJ4f18uno3GzrDR8MJAfYMshoHSgu60F/r02yU1umI6+056AgHrYD/+ QADQ== X-Gm-Message-State: AOAM533Hc8TcyR+b0Igsn2NpGTj+Q3PaFfbsS3ncwu9Ot3gM7pRu/jwA t8bccTr4RXMIqgKQqm7+yizRqwRhI2Pn5Q== X-Google-Smtp-Source: ABdhPJw0gyeFnw57oxp0sq6bqgANIsrzObxRClwQk6Sv+DHCrMObVZ1M7XOYXmXPr5CJvAsoBP5qig== X-Received: by 2002:a17:907:1b03:b0:6ff:78d4:c140 with SMTP id mp3-20020a1709071b0300b006ff78d4c140mr8861505ejc.554.1653991217575; Tue, 31 May 2022 03:00:17 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:17 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 05/13] drm/gem: adjust per file OOM badness on handling buffers Date: Tue, 31 May 2022 11:59:59 +0200 Message-Id: <20220531100007.174649-6-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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 | 19 +++++++++++++++++++ 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, 35 insertions(+) diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c index ed25168619fc..1959a5b7029e 100644 --- a/drivers/gpu/drm/drm_file.c +++ b/drivers/gpu/drm/drm_file.c @@ -1049,3 +1049,22 @@ unsigned long drm_get_unmapped_area(struct file *file, #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ EXPORT_SYMBOL_GPL(drm_get_unmapped_area); #endif /* CONFIG_MMU */ + + +/** + * drm_oom_badness() - get oom badness for struct drm_file + * @f: struct drm_file to get the badness from + * + * Return how many pages are allocated for this client. + */ +long drm_oom_badness(struct file *f) +{ + + struct drm_file *file_priv = f->private_data; + + if (file_priv) + return atomic_long_read(&file_priv->f_oom_badness); + + return 0; +} +EXPORT_SYMBOL(drm_oom_badness); diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index eb0c2d041f13..768b28b198cd 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_oom_badness); 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_oom_badness); + 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_oom_badness); return 0; err_revoke: diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h index e0a73a1e2df7..5926766d79f0 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_oom_badness: + * + * How many pages are allocated through this driver connection. + */ + atomic_long_t f_oom_badness; }; /** @@ -430,4 +437,6 @@ unsigned long drm_get_unmapped_area(struct file *file, #endif /* CONFIG_MMU */ +long drm_oom_badness(struct file *f); + #endif /* _DRM_FILE_H_ */ diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 9d7c61a122dc..0adf8c2f62e8 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,\ + .oom_badness = drm_oom_badness,\ } 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..455ce1aa6d2c 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,\ + .oom_badness = drm_oom_badness,\ DRM_GEM_CMA_UNMAPPED_AREA_FOPS \ } From patchwork Tue May 31 10:00:00 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: 12865227 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 8EA03C433FE for ; Tue, 31 May 2022 10:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244496AbiEaKAh (ORCPT ); Tue, 31 May 2022 06:00:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245429AbiEaKAV (ORCPT ); Tue, 31 May 2022 06:00:21 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7247385EF2; Tue, 31 May 2022 03:00:20 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id t5so16807078edc.2; Tue, 31 May 2022 03:00:20 -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=z7tQVrAvhtwsiyqp5g4EfVxGXeEppLEfrV1ntrEYWJE=; b=Xh9vdv7Md1Jc0nNaz/QEZs5wsG3AfJ2/jRFF8rTAcPZ6QG7f0rxiqBLYOf13+3PUe5 DS/CL5kAFDHB7/bv8EYLoIYIYA3Cx4+ppq4UyjhqSGPcSsG+p4nVI7VGhcdno4MC08p8 XVfyNLF1mWExyyS8ZBwIS6tDDHVn9frsIcma0mUCQvKpUlAle8k82hD4G+7Sd4WdVmlz 3Cwt+4X8TIMztGZf/ISlFleQ6/rglSf1VgibZ0Ewo75ycww+oCt0RuyECJkUJZ9D3opK u/Qh77+csPwSloqfrGgfn1EfcZpOm7AfMN65GulQjeG/U1vHukfs/GzY6+Kbrf4gD0d7 2ncA== 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=z7tQVrAvhtwsiyqp5g4EfVxGXeEppLEfrV1ntrEYWJE=; b=nsPS0IKYPq3Uh/fLmXmLklePJOipSWlroquZopF1i87MZ7pIinyRcQ4zLvRxiNhvsN ERm0jvdaZ9bYfyF7LJIYOlRR/p6RIk7NXmUCf834XDCjxHrbrq5ITkY905Ml/EGMjWIT UGNbdg3LVvwCKK8mlzLsZ8WvNclXXA+YQr+7tiuvhPjKukviAjiriKiM2Mo7MV1KseuQ 2JPb5XTg7O1go/fSJJJG6HlwCFr6g/W+Ykb1DeFo/T/pN5aAECVEctBX4IuFGDInHzUO 7w0yaPJZ+V5+Rf9vyUmXSsyhHf9Bgu4Jgcwmk5C+t4z+5DWHxS3RBi9kc21m1k6BvBBT 0s3w== X-Gm-Message-State: AOAM531V5pwzy57xNuN3EJLgQC7WTuGs3Ha6L1S3iFGmDcT1gRDpAucH 5BOB9SpqltgNW2o5j6Rr17ae0j5Bma78Iw== X-Google-Smtp-Source: ABdhPJwU+/41hzABOSPHIeWy2MYGjljgCs1L+eRQW55IH1wpboag3ARspMl2JoO5SvKoTgZp0xZVQw== X-Received: by 2002:aa7:cdd2:0:b0:42b:aeb2:bc99 with SMTP id h18-20020aa7cdd2000000b0042baeb2bc99mr34074044edw.382.1653991218991; Tue, 31 May 2022 03:00:18 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:18 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 06/13] drm/gma500: use drm_oom_badness Date: Tue, 31 May 2022 12:00:00 +0200 Message-Id: <20220531100007.174649-7-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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/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..d5ab4e081b53 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, + .oom_badness = drm_oom_badness, }; static const struct drm_driver driver = { From patchwork Tue May 31 10:00:01 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: 12865224 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 3C678C4167D for ; Tue, 31 May 2022 10:00:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245485AbiEaKAd (ORCPT ); Tue, 31 May 2022 06:00:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245440AbiEaKA2 (ORCPT ); Tue, 31 May 2022 06:00:28 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E256F84A23; Tue, 31 May 2022 03:00:20 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id n10so25580324ejk.5; Tue, 31 May 2022 03:00:20 -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=RT3RFL0VBSkluM1f3vm/WSgrGA2Qjw/08Ja0Fnc8nAM=; b=pn14iMQ9n0FDWwmArA4Jf35k//oaml9s3mxFl2ky/DMcmh2eS5QQUAfVDrFOHrWe0F KMtAdL2ItYXoMBH38/cM7Y5adUTzh6hcJoR+bDw3M9kaX7/WIFSLDyC89uegMORBvy8a BHKTy4vuZTReGoejbiTSY6UKILNxobjAL1xvmGcoXh1D/U10MyxWoiEN1o6YdrZUfevt sj80RQonfCLZAawaQ34qBTRrlatRa3mUKNi0wDk1pC3/0cWVa8FNjNAuvChUXdFusk2T xG3+L8wayhRfjE/jFGd2K1s01WQzFRlhAG5nSv/aQI6SJBaKFuP7a15DEZJ3u2J3fVab 1s1A== 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=RT3RFL0VBSkluM1f3vm/WSgrGA2Qjw/08Ja0Fnc8nAM=; b=q2ME/bkkJkPttlsZqtSfGSsS5zhcgdEyFuRmvifmCiSQSAxKYEz8i1Tt0kFdtt+1tV 1ssEcJBQGVTW9WFux8iGS4CyJjPGrtKbdAOEMWzU05tmJ97kOuyRzFL986nW8ZRaFG03 cKe0EM/txjDUS+VwYJBAYE8xslChF8wIoDvqIGPMcR0QBjdz1FkSzKv57Ui+2gQg2S73 ISUwPEceYxu0o/93+T7ja8SGuyurF21mirGfapRxuBTzYCLZCnunSc3TQAG9On//yV5k 4MsZfi7roksrGIKccOnmzhXDwTkN9gcYfctW9YU6DB+SjCQd6n32cOygTuJUodF76cr1 EWmA== X-Gm-Message-State: AOAM532BEbfgnndLaYTN7RJwfAmWblS9orofu5uRdbNGaIWzV6xIVOOA vcCOGtGr08UzRJpaOIx4CNwMqkCbIm/orw== X-Google-Smtp-Source: ABdhPJw2HPaoRajF+IeqkgNAoVDs/MgxP3po1idYa4R4fWsq47S5BbJXHf6FD6GIdoI/D1SZlKNRiA== X-Received: by 2002:a17:907:2cc4:b0:6fe:2100:de21 with SMTP id hg4-20020a1709072cc400b006fe2100de21mr52095547ejc.462.1653991220342; Tue, 31 May 2022 03:00:20 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:19 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 07/13] drm/amdgpu: Use drm_oom_badness for amdgpu Date: Tue, 31 May 2022 12:00:01 +0200 Message-Id: <20220531100007.174649-8-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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 ebd37fb19cdb..9d6e57c93d3e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2651,8 +2651,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 + .oom_badness = drm_oom_badness, }; int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv) From patchwork Tue May 31 10:00:02 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: 12865228 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 BCFD6C433EF for ; Tue, 31 May 2022 10:01:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245554AbiEaKBK (ORCPT ); Tue, 31 May 2022 06:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245450AbiEaKA2 (ORCPT ); Tue, 31 May 2022 06:00:28 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43FCC87A2D; Tue, 31 May 2022 03:00:23 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id f9so25641882ejc.0; Tue, 31 May 2022 03:00:23 -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=0fF+SmUCgmGBHMWIupVoHZia80K1ptfL7PQV1qLHe5E=; b=pGad9b/BwcaioFOjylZCfm5P6oSeZF3Qa2xsSM2t1mLTeOulJ6Fk7o/kQXSFGfU7lJ fp+6f/aeJYjHr4ThwoNMeFWvRYk8Xi3t4V6MuHjD4pXyJ85cRklWkQW6ame4vh7fx+mt eaMJgziirhMF0TIu3swNi0t8QcgG/D+TrXhYN/6zpOjgadE1pDN936EPEKG/3T0VKKBY eGDD/HmuCJdKW697mwOSCL+AIzK1PpEsB7W8mV3UO/gZVPIZSxHIDtHAeMFs64m0dwsi kXbIgj/gmD2mW2jfFnmLmUvUEs8rVjrgUuJi5qMnGsABI9in6Ar4JrgyhpFWFSv1YPAZ psrA== 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=0fF+SmUCgmGBHMWIupVoHZia80K1ptfL7PQV1qLHe5E=; b=nTwOKydqhN5bacDl8hSTSRxO1mPqYUXLZErC6ER51tBidOrNfuYj0CuLzySkYKkB3z NngECq4ySp5yIsE4TDxsRKv56V97PUusccFdQkDfVOSPEQFeknvcEXdfefogiqormguX PlQC90/mbZaIcBDWTA95bBA5diMz79Dll7VaLUXE9kXILsiSKZ9zu/pttLypxfVmkAee HYVoJI0T6Hb27oD1Si4iKIpuLb9QbRMVKbtfDD1YplzrVDSFmy/nf+YaDIBrKZcII/1u 2zksRBSFqJWjRXIYQxZ1XgOPHfrTkqTuOXcEv0htf5DKGJw7n1T1X2ayUVaKKD4CJPS3 XqcQ== X-Gm-Message-State: AOAM532cop1F6/v4GdW1dgs3Q7QKNp7SJV0/ymS6rXW6/p5Peq8RztW2 56+sL7d6/8zDSXZBh3MznR/eDrgR1CxM2g== X-Google-Smtp-Source: ABdhPJzxN/Ir8FJD89b6qow8Ub7cZ5+SzEkXV/zrFCVZFTH37oV1HNV4o+OUoqVfB6+SbpZEADHJkg== X-Received: by 2002:a17:907:9482:b0:6f5:171d:f7f5 with SMTP id dm2-20020a170907948200b006f5171df7f5mr53043726ejc.68.1653991221803; Tue, 31 May 2022 03:00:21 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:21 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 08/13] drm/radeon: use drm_oom_badness Date: Tue, 31 May 2022 12:00:02 +0200 Message-Id: <20220531100007.174649-9-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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..7e7308c096d8 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 + .oom_badness = drm_oom_badness, }; static const struct drm_ioctl_desc radeon_ioctls_kms[] = { From patchwork Tue May 31 10:00:03 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: 12865226 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 4C419C43219 for ; Tue, 31 May 2022 10:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245439AbiEaKAe (ORCPT ); Tue, 31 May 2022 06:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245452AbiEaKA2 (ORCPT ); Tue, 31 May 2022 06:00:28 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BA7387A33; Tue, 31 May 2022 03:00:24 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id gi33so25609123ejc.3; Tue, 31 May 2022 03:00:24 -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=SAtySkLvcNUXzz7ib9IziiicjVedfmYHvbHXwfWUJSo=; b=ezNoQAUxlApzRSlxG4JiS/YCWxGANQEMBMCQgATxnhP3gp3+ZMVr411g/URtHp2KFA f2ChR3RFwngrCVs7MCiQWoekB8YkFKK+caOAEKNtMtGAJPRZLUJ7j2c00h0X9TNtL0T+ aHJui7m2EbzQadDD+FbLWipH1ktNgQpHm6lf1sj28ZZvD/1iiXkps8ipinLAy0O42RLY zTTegaIaDQYL53vJKk+O5RhcAs4qMBsDl6YHcQkYjXJTY1EOfzlpFLZZ/uwgiQXHKYDy rZAwphV2HGF7mwKPv8gVMLQ03jkfQzE4TopEkv5xWw0C5eXfVpfmNZ6CvesBT9o5ZvqD ltxg== 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=SAtySkLvcNUXzz7ib9IziiicjVedfmYHvbHXwfWUJSo=; b=Qi186EXGsTGa47+LcWMHbqv2ZHoPrPtOfUP5O3cKg0hVFwirUKgLyisM6OcMaR0wHc LtMciFs+qLv94DjvLcUCxnzvFxZeVDgUhcUxBOYhaGElJct1cQT2xcnL1eXcnsFcCSDR EPr2ipPFA9v80NlBIHbscyOTEoFZWNk0UdArhb9783nCToEYdtHuPbcuuf1bxZOz/B7+ Gw7YVm9BMjgf4awzadBVLWq6SYw/cbvp1+S+YICLnr+z6EjfIGe9gPiZCNwCO6mlkvUX fvJQkMpgwk5Mb0J7PrS/sbLa4v4swPzzSZirmOR4ysAqzAAydBkNN7PePGd8xPn10MB0 GTKA== X-Gm-Message-State: AOAM533BZYtQBQkUle+fOOySoOjPQMRUKyf2sG5a8X3T2e8Hb710hWIo 3E3A7fmn2rYEBeslPOcxqTryUHkXGKUZKQ== X-Google-Smtp-Source: ABdhPJxwBRRiOzRIc4wcP7bPQevp2uh1nTKIEri7IbT6+yRjL76vQVcRcKWHOXi4dB6U6w/w9RxFJg== X-Received: by 2002:a17:906:974e:b0:6f5:2d44:7e3c with SMTP id o14-20020a170906974e00b006f52d447e3cmr51605009ejy.167.1653991223194; Tue, 31 May 2022 03:00:23 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:22 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 09/13] drm/i915: use drm_oom_badness Date: Tue, 31 May 2022 12:00:03 +0200 Message-Id: <20220531100007.174649-10-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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/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 3ffb617d75c9..f9676a5b8aeb 100644 --- a/drivers/gpu/drm/i915/i915_driver.c +++ b/drivers/gpu/drm/i915/i915_driver.c @@ -1748,6 +1748,7 @@ static const struct file_operations i915_driver_fops = { #ifdef CONFIG_PROC_FS .show_fdinfo = i915_drm_client_fdinfo, #endif + .oom_badness = drm_oom_badness, }; static int From patchwork Tue May 31 10:00:04 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: 12865230 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 7106FC433FE for ; Tue, 31 May 2022 10:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245579AbiEaKB4 (ORCPT ); Tue, 31 May 2022 06:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245454AbiEaKA3 (ORCPT ); Tue, 31 May 2022 06:00:29 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40E5880C8; Tue, 31 May 2022 03:00:24 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id t5so16807078edc.2; Tue, 31 May 2022 03:00:24 -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=CBtdyMzsAJ1/aOexJ9rl7ZeO2ErFHAD5HxTQN3Dqn3Q=; b=clhRBft+k4X+UmpE7If794qBfOtGFA7pbEByZ2pinyy2YRsA2O6lLDOynJMSIVJoFM Wvro65LH9mtebwNBzBwhrtxkvox46+r6wwZH4eYd+mYlM8gfp2s7dxCrtouRZ2HvQ9rb 5qqKVWSj4jEdYbd8S6LPV6K7PJCG4fHMCcDZkvLBlGNukalvsGNQKBVKwFWP7x+ZUNc0 mZXiAkmse4krF81HSAGDete8t78Ll4SG7G5gaBi9gesUSTbQOYIe2O3LdV31q8XNetNL YzKH8enFbBx54aGHmjR5bRjrnOqioVrO6oNE62MwqlFCmvCaYYCBPM8DqoQ36EIiOpxJ EWLw== 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=CBtdyMzsAJ1/aOexJ9rl7ZeO2ErFHAD5HxTQN3Dqn3Q=; b=Nqf67QK1xFhpnv3I+0YooXGTyza+0FyGc63aFgiOHpDkLk8bGbIdomrtXLmfObV57J DtG/u2Bh+5rHsyAPgSXG2qAnu8n7yueXB6DX9KJ55ZR8jF0TYOUk3PfMdUGqFYT9p3/q ZfGJE+x6gizeti6Fpxnw3zOWzB8kxaklkjEwyl62Tf9xHN7YrWV7l0hJJHOGLu1kuAvy GHjw2hjxUtEbcZKGwYXPJopHt3XlKOKH3bNe+lJHIjoelIbACxCoBYwVKLGYf0BG12Lp phNg4TKGFiljbQgwr6f5kgZhZYwAkjIZiI6ThDJabLKBn4PB0VKb+Hm6q2NxO1wZ7FDY ImcA== X-Gm-Message-State: AOAM533yI1m1A8r4YarlX8Wkm3XlUzAJlaVblAU/VnBoOiuImk0UeemL hG2FsgObjE/Zye8SQvbq0PLeDvUE0u1NtA== X-Google-Smtp-Source: ABdhPJw42FrkjYM4LnR278q9mfBravYOk4Zj2lNKJYJUZ/HCUi9Q4cA6PZiVhbQJK68MTRAAzi0sdA== X-Received: by 2002:aa7:d285:0:b0:42d:ca4f:a046 with SMTP id w5-20020aa7d285000000b0042dca4fa046mr13232089edq.354.1653991224557; Tue, 31 May 2022 03:00:24 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:24 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 10/13] drm/nouveau: use drm_oom_badness Date: Tue, 31 May 2022 12:00:04 +0200 Message-Id: <20220531100007.174649-11-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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/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..5439b6938455 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, + .oom_badness = drm_oom_badness, }; static struct drm_driver From patchwork Tue May 31 10:00:05 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: 12865232 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 0670AC433F5 for ; Tue, 31 May 2022 10:02:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbiEaKCC (ORCPT ); Tue, 31 May 2022 06:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245461AbiEaKA3 (ORCPT ); Tue, 31 May 2022 06:00:29 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 632C0880C7; Tue, 31 May 2022 03:00:27 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id er5so16782195edb.12; Tue, 31 May 2022 03:00:27 -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=JruBtp3H6AJykO9OR/eL1GiHC7q7udWmPGM/sruwocU=; b=gblxCfTt5pOw7A9YHZEJV+r2VG2ChUPoOQENqtkp2cD9u6jNXJgjxv2GFFFMsM/j1v Q2bAWtuYoHVtOWqHe7hjKmrV3TsMB+pNFCxXxg98Hxoy145vOkyrtRBbQ1b4zZpA+A1+ m3vrIpLanU3qXFTpv1WHgWerwCM08gLxzMyuLrfLY2BLdTpWmtpZZCIA8VnGVxQPJSGw xqv5Ii2BDXG3LKm7eR73P/dCNDyy1at1PARvuyUQJ4QUTBg+DKyDnVUw6Iop+kGwRAzR hJvsA8R/+LW94eBMAMh3wccqPVIx8QKXEc5XbXbso3UNdF0HbknOCrBEyS28rXYGBpJ4 wTKQ== 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=JruBtp3H6AJykO9OR/eL1GiHC7q7udWmPGM/sruwocU=; b=FU0CaP1yyNOiUsROoOGnE/GK2s/hqKZMFHlJhUAgsLPCB3qEYItB6R7D1Kjm6v/T+E zum1YSidMEMbK6cZNH3ty8eorbktpCQgiKuW/OVLXoOMiInins7NoI7NkrYleizQ698c hh5WHfAKgRvF9UoXkNb13D2Hr+9ZHmBj1iNWjIE7oy0VNYWNq5j0hbk3JjtV5iReUeLy Ixfw14MhPg7Jy16I5LVvCseQ66sN69+upFxOXsfu/yNpIV0EJ0Rlo9A8labBjO9etHJL thNlelDrwvI8R8RgXk7FyMFOCpFl8abmH9UpNKMSkr1lxCfbETxsaOGIP9Vfmcjecciz aG1w== X-Gm-Message-State: AOAM532yIh4+RSgwwzUBRLyNrCcqzR3QF4foOkP/J1Jozk4tGazrYyAN aWkSk1gOICm39QkHUH+Hz/Rby0HZmUrofw== X-Google-Smtp-Source: ABdhPJxrLNkOBCK22JKPARmcl5BjmY6TUTpFvEk9uA+1n3mHpJJ9+WrPqf1O6PJKP4JfkZxzMsKPKw== X-Received: by 2002:a05:6402:350b:b0:42d:d565:a62a with SMTP id b11-20020a056402350b00b0042dd565a62amr7607557edd.172.1653991225974; Tue, 31 May 2022 03:00:25 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:25 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 11/13] drm/omap: use drm_oom_badness Date: Tue, 31 May 2022 12:00:05 +0200 Message-Id: <20220531100007.174649-12-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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..ca2c484f48ca 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, + .oom_badness = drm_oom_badness, }; static const struct drm_driver omap_drm_driver = { From patchwork Tue May 31 10:00:06 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: 12865231 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 62E93C433FE for ; Tue, 31 May 2022 10:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245615AbiEaKB7 (ORCPT ); Tue, 31 May 2022 06:01:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245468AbiEaKA3 (ORCPT ); Tue, 31 May 2022 06:00:29 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD4484A00; Tue, 31 May 2022 03:00:28 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id z7so5958261edm.13; Tue, 31 May 2022 03:00:28 -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=NiGv7XqpyS2XED0WdTZJaaW3qxD3EEwJnBgFNlUBlKA=; b=aUB5B9Qt8tVriEh42JHF6p0XPngykorf81VEvkU+jbQb7CSF/l+p5bKKOyZ20uEgsA E43T85l2RNnZ7ArvqSkvuaTiD93Z/Q+CcF5nsxGUHtbZPnk25OSTrL4t5vJROge1iv08 D43ebZ6vcKHFJLX+daUhnhKonDnOhJN9wbzFrqgWFfIh7GjGBXxWi48JT9I+x8K6ogvq Gyvusf+zhEL6Gk09/w34fLwp6G9rdW/r/FFrInAhnujV6+INA3rKvI4kTTFmibLu1J5X yfuU2boXQuUY1zqYSg/AQttssmci0RltzIdFgKtVRPa9qApgcGl9lqhFBcWEyD7XIwTB xPcg== 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=NiGv7XqpyS2XED0WdTZJaaW3qxD3EEwJnBgFNlUBlKA=; b=FaqtASZZb17pjWYFKDJD+uZoTjzidO6FoNahorxFxt1eYpE5Cjm7D7VKSR+cEN/DQp grZu988W5q6ZBL2c/fgaqkDbN6oA4VkkpN2e98yxc7PA2byEo0df68STYGa0whSFXaZG 36sG1KxNc4v8eidZ0M2A9ZjQPKyhdHMwm5Tc+BBg8aJLLV1WM0zZS3QeMDUB+x1bzpOA 0tmLht1LpOmwpr9R/pdpBau5RzUDg5ShNiqzg6dVc6SsR6hKSu0cpFZTqzTa0IecNKO2 uzY9K+vNkE8ucFjR0K4FbPmSkgcbRydzAF2Z11DUoWQANbHiNTJAX4fHW4Le0r/vUs/j 68FQ== X-Gm-Message-State: AOAM530udPkOsHuGODJGngMORUvuYwNP6S4Z8F1aykRirvmjjjiE/kl1 YLVEkL1EapNo4/+Nr7kG5YNXF7uDYjPTOQ== X-Google-Smtp-Source: ABdhPJxaefghKbMHCtIN9ZsUiLrQ9JGsM6ui0kyhG9BoMRuUMSSLwMZQJupGKdHga/0PvqPhhZrEmQ== X-Received: by 2002:a05:6402:90d:b0:428:c1ad:1e74 with SMTP id g13-20020a056402090d00b00428c1ad1e74mr63021246edz.345.1653991227420; Tue, 31 May 2022 03:00:27 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:27 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 12/13] drm/vmwgfx: use drm_oom_badness Date: Tue, 31 May 2022 12:00:06 +0200 Message-Id: <20220531100007.174649-13-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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/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..e447e8ae29be 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, + .oom_badness = drm_oom_badness, }; static const struct drm_driver driver = { From patchwork Tue May 31 10:00:07 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: 12865229 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 64F9DC4332F for ; Tue, 31 May 2022 10:01:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245514AbiEaKBy (ORCPT ); Tue, 31 May 2022 06:01:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245471AbiEaKAa (ORCPT ); Tue, 31 May 2022 06:00:30 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41C6284A14; Tue, 31 May 2022 03:00:29 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id t5so16807078edc.2; Tue, 31 May 2022 03:00:29 -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=dox2mMkLl/5c9D2gga469zGN9zQ+j614KEWkuEZ4MV4=; b=TtHtny7NdbtnaKMNgHxxZ1P6YiZMqlmrfAD504KQpkpUdOed8kz6s4qe73Oso8t6aL GH45XnJdlS9fPbcsu06cjzlIDPfSLe4vdmLZk7L0colYmkysDdcFQUfaXrpgfhWM8Uu9 mwNsso9fA2grp70nK3W+gfRLzK4em/GxgeHMyOxZAQwF2uHJZHUlKeoWDTsO9Pf3mIoR +MU2pw1Hj93sIubQtkBk95FwjgyvioAIuxLDOXetbKFAI5WclUufvdU4gR+xUVC90tO0 kjPZ8sljqOzsGufGGBR2iVo/n5ohkrTAeCPS+lQRYxTn5nYYxcG4Bmjfy2K5n7PsifJS ohDA== 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=dox2mMkLl/5c9D2gga469zGN9zQ+j614KEWkuEZ4MV4=; b=R9EQlfnogdhovkuWtbKi7WmNKNGzsgbZzVQcou2RUYVzeU3Z1K/Q9/0Hf/VA291VGC PJcI1he9qf43XlhXd2zDECwCEuridMqly+xh9uy00J012va49lpQX/xDBIDxKO0Gq1Hr 89H2ezS3LCdFQZshRPneapEvds22w3qMl88tY9CWlbIn/1PgZ4r/swKkLF5ylb0jR5Au a5uON4cJc9MAWGoR2n4eD785pwbtlKXH3XvsV7/i6g56lanyyzkxtA//uzh+PF1aYNwE KYcIkbTyT0ODLPgrInmMBC649i4ufFJ/IyWu4JnS70uDwXJdU1CWb4+VRiiui9czkC8h 43og== X-Gm-Message-State: AOAM533ay4mCTKdrXplfP9GfFptIV0dqH2UB+WIH6E3x6U8zFUKUOAck UZRRf92qB91xKHUnRm8wH7BPVbp6SLtYTA== X-Google-Smtp-Source: ABdhPJwaDMI96aKfbI0lqqtNolmvi5yHB6A4EjRXIsAbd+0AZ25rrn/qiMxaKibl1aGvqzYNEfcjIQ== X-Received: by 2002:aa7:db02:0:b0:42d:c3ba:9c86 with SMTP id t2-20020aa7db02000000b0042dc3ba9c86mr14927377eds.337.1653991228918; Tue, 31 May 2022 03:00:28 -0700 (PDT) Received: from able.fritz.box (p5b0ea02f.dip0.t-ipconnect.de. [91.14.160.47]) by smtp.gmail.com with ESMTPSA id r13-20020a056402018d00b0042617ba6389sm582062edv.19.2022.05.31.03.00.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 03:00:28 -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 Cc: christian.koenig@amd.com, alexander.deucher@amd.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hughd@google.com, andrey.grodzovsky@amd.com Subject: [PATCH 13/13] drm/tegra: use drm_oom_badness Date: Tue, 31 May 2022 12:00:07 +0200 Message-Id: <20220531100007.174649-14-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531100007.174649-1-christian.koenig@amd.com> References: <20220531100007.174649-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 9464f522e257..89ea4f658815 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -803,6 +803,7 @@ static const struct file_operations tegra_drm_fops = { .read = drm_read, .compat_ioctl = drm_compat_ioctl, .llseek = noop_llseek, + .oom_badness = drm_oom_badness, }; static int tegra_drm_context_cleanup(int id, void *p, void *data)