From patchwork Fri Feb 2 07:22:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10196329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2EEDF603D7 for ; Fri, 2 Feb 2018 07:23:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1613228D75 for ; Fri, 2 Feb 2018 07:23:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B1C828DF4; Fri, 2 Feb 2018 07:23:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6244E28D75 for ; Fri, 2 Feb 2018 07:23:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 853B76EFAE; Fri, 2 Feb 2018 07:23:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0083.outbound.protection.outlook.com [104.47.32.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 17F1C6EFAE for ; Fri, 2 Feb 2018 07:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SC7kXQ0AV2mKQt3XONhe8QVmMSY9XMNYbfzNnAGrI7o=; b=2vVJxTo3Lu/shD1uRM2cCP/WxvZV7o2ol9bI3vJHESFIRVRncDmarBsAmfcypTps0H5zTIbBMWeRr44L8IdUlPPN63F8aPTJI/yazvC/gFQxbF1GQ1zA0Vg/RxjRARlcNTSJXQtx7UP3rSn/48Bd+EfVLuTWQeMDOMBCuVYqVus= Received: from BN6PR1201CA0022.namprd12.prod.outlook.com (10.174.238.32) by DM5PR12MB1449.namprd12.prod.outlook.com (10.172.38.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Fri, 2 Feb 2018 07:23:00 +0000 Received: from DM3NAM03FT018.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::201) by BN6PR1201CA0022.outlook.office365.com (2603:10b6:405:4c::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.464.11 via Frontend Transport; Fri, 2 Feb 2018 07:23:00 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by DM3NAM03FT018.mail.protection.outlook.com (10.152.82.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.464.13 via Frontend Transport; Fri, 2 Feb 2018 07:22:59 +0000 Received: from roger-build-server.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.361.1; Fri, 2 Feb 2018 01:22:55 -0600 From: Roger He To: Subject: [PATCH 2/5] drm/ttm: add swap_glob_mem in ttm_mem_global Date: Fri, 2 Feb 2018 15:22:22 +0800 Message-ID: <1517556145-23505-2-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517556145-23505-1-git-send-email-Hongbo.He@amd.com> References: <1517556145-23505-1-git-send-email-Hongbo.He@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(376002)(39860400002)(346002)(39380400002)(2980300002)(428003)(189003)(199004)(316002)(2351001)(72206003)(104016004)(8936002)(8676002)(97736004)(51416003)(7696005)(53416004)(86362001)(81166006)(81156014)(47776003)(76176011)(305945005)(106466001)(50226002)(5660300001)(54906003)(4326008)(53936002)(50466002)(59450400001)(105586002)(48376002)(16586007)(2906002)(36756003)(336011)(26005)(68736007)(2950100002)(186003)(6666003)(6916009)(478600001)(356003)(77096007); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1449; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT018; 1:2aOIjebOUYzKGfcVCRZ/z1dy/MI38obFOVatFRens+UdJBq9qlQAZ1hq/k0nh04FdADAJdK9EWOzg3cg3lvUsQqPuJb9ta2LisjPMsAD1dHxMVj56cCbOF6wdsdmqGDD X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9d06b0a0-6081-4929-9a7f-08d56a0dca0b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:DM5PR12MB1449; X-Microsoft-Exchange-Diagnostics: 1; DM5P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boz7xOQKGmmQ9BbA4FYYWRopl5E8VqQxfUlVn0cv1lbdlTNIQJJgLVqOXkJsuSjE6z4yPssM/IPn1AouikwxcIAKTjL+iwPcWVrcWqDqVpfJHARjP1aPjbyEfwkU2bG3agXS288v7G72Y/LNf65chk8fQvzoldSsxtUwp4wVEmrpQ5LlAUgZa+G5njSWj8CaG60uKobUYCN7lkvey2Qds5dxqOnKcU+hBmtgsulpEAsK5SfGFTeeFmM1THqtqHpSaF7xJKeqHc9hQww//aXOvH0TkGXx1zUidDFktojQzUv/Lxy+/YKQmbU32lrxdRjvIfb2D/hgfqfCd4PWQLqsrTRQPCZYdv1o0DrjZiqRO+QoEo/jKvhGR1OX7YyOw3V7sD4U7t6MuHhDyqPI23W8KwAbwSCPem/K8f4vpajzXeRKXKQ4HL1o88UOogw+riwZV+2N+27+gio X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93003095)(3231101)(2400082)(944501161)(6055026)(6041288)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR12MB1449; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB1449; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1449; 4:xwVX3GywPil1K+9s2CsHEB0tuOIDmx6CpPrzyi2RafODA/kbMpKONMQ4viSkfPITrTDw918/x8sNui4f9FxS/SOHWF9INymH/7hRZz0KNSK/xh94SqlyKqG4Uq1J3ueNyZVzPHRxoIGdBd90f6wXCz4rkuntOM1TGlMZiYC+VT0xPQ4HI4/5SshuWSA0F2AugJ8aFwGL1R4A0tmZAdGeo8SiMmybThoKh9QN+7jBZpXrPd9IGEN+1gM6as2Kr7iX2CjqZuvpF01qXmujNejVTCyFLR6jEUH/Av5zmUIghdPc6BL8CfB72rF8EVt6K2EX X-Forefront-PRVS: 05715BE7FD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB1449; 23:MIMAyU9vuNgNXNz7x5FH5oa1hI9Uz+JFLnUT2aOCB?= =?us-ascii?Q?P8Bvf2SoEVVMpSwUvfTM70+lHTE4/Vs755LDkFnRoiFU62z/Hol/f+QENRCu?= =?us-ascii?Q?g3x2Xz26J4kZiRjkkHr8Ce8Mlnz5YkT3/v/CyC4UT7SCiLbrzPwiD/tTL7nr?= =?us-ascii?Q?AOD6YVaaFo4hq6Cn9J5f1kIFIjrkxvSYh6OQzxbJsKsL5oiCm0Sxt4Ydgx/C?= =?us-ascii?Q?vZZlwqVE1yVCBImS3b5A0G45ac/fP4hQ1JhgSkdPgwfMnGcaCHsoc4td8wR8?= =?us-ascii?Q?4W/0VGU5/5KO94C1ScfAreCDwRECsHJMcTEtEqttdq2ETaCesGT09UxRpojD?= =?us-ascii?Q?4cQ53N3P73auymyXEgxjulrnciv3oOEtZtufJZSIqiK0jCcmA+35B2NKnrjx?= =?us-ascii?Q?Xqyb0fps9KN5oXIHGtfqYrFiok3WgQ/NQZC5IKV3G70OpA12YCWOfYsaO1CF?= =?us-ascii?Q?9fZmoU8sUbIvwnYHnQQY7pkEuMBs1JZYkQn+txElmeFqlLMddRtx0GDud+ul?= =?us-ascii?Q?4UB4ol+fx7g/9L/rfaWOvkBOUaMk/4LlkzoeuKoc3GdlLy2M+G5Q+MYzf/LH?= =?us-ascii?Q?ouGYF7pJZMbMmPqx4qd534BMg8W0C++QYFAiTSVVe6XIUEivzZZIkVzMqWZH?= =?us-ascii?Q?AN13Ynw3zxMzh7CIZy6AF31NGYtrICl6CX5BWZjut+7ql01K/A/j5W3I68t+?= =?us-ascii?Q?5EnxVKhaYiHswgppIrSpMtGEhxLwPrmODpBIQDLOkhCk7le28Tv++bk028dl?= =?us-ascii?Q?SIrlcqz5sgbTk6MnOm4OiCDX/VXS/yKcpgYaBl9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1oqZYwVZNpS2Ff3LQ+2CIRt/H0N/PKcqcKR587HvF4Q=; 7:zZstj1MUw1Syrj109xparCe9vYAolPjIxLxcN1QlR2iR4qh1lePFRuoGWUOtIovTpn16KsGVKDEJB6JIayLI7HBnNl08yHUm5c93S2a1qYtWFrwHq1908txN4XZbS8D8m5X4cY6yTnl6DAMVnPWcO6GyVk1cy/Ipa7xc35LiyWATwnyCDqv9zIwxCe5P9o9glO7StfbbmT+0fcKrAT3JQ3E8LARNxJ4kZegkOd5u7AKV8Ie6k0gXe3kz7oXcidSQ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1449; 20:hQDA+e4OaFqVT4UN1t52AoHI21Fvf1yfgbjyxO2UPBEAurX6OczHZIqQBLKQ1gfEz83GYzMsLTxkA4Cr8evM3XPl+CgsGKmPuCX0l4glmncFnP2yWDM9+mH9pFDudF7lnEq2yu8wVtCVR9TMSFMbhGWOSbpUCSSOcv8AYpOll6ReFo72Z7tR253pmsaZeQdlIBmRRQLOQ+gaeZJ8NcKlo8sd0l8xbsH1uaPDKFVxBGX+tw4ATfKhhQSjGt4vnZR9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2018 07:22:59.8576 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d06b0a0-6081-4929-9a7f-08d56a0dca0b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1449 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roger He , Christian.Koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP separate swapped memory account from zone->used_mem because swapped ttm pages can be flushed into SWAP disk/file under high memory pressure. add check conditon in ttm_mem_global_reserve to prevent triggering OOM. because if swap space is full, all swapped ttm pages would stay in system memory which can't be flushed into swap space. Signed-off-by: Roger He --- drivers/gpu/drm/ttm/ttm_memory.c | 12 ++++++++---- drivers/gpu/drm/ttm/ttm_tt.c | 13 +++++++++++-- include/drm/ttm/ttm_memory.h | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index b48931d..598b14b 100644 --- a/drivers/gpu/drm/ttm/ttm_memory.c +++ b/drivers/gpu/drm/ttm/ttm_memory.c @@ -197,7 +197,6 @@ static bool ttm_zones_above_swap_target(struct ttm_mem_global *glob, target = zone->max_mem; target = (extra > target) ? 0ULL : target; - if (zone->used_mem > target) return true; } @@ -375,6 +374,7 @@ int ttm_mem_global_init(struct ttm_mem_global *glob) } /* set it as 1/2 * swap free space we can get at that time */ glob->max_swap_mem = get_nr_swap_pages() << (PAGE_SHIFT - 1); + atomic64_set(&glob->swap_glob_mem, 0); si_meminfo(&si); ret = ttm_mem_init_kernel_zone(glob, &si); if (unlikely(ret != 0)) @@ -475,10 +475,12 @@ static int ttm_mem_global_reserve(struct ttm_mem_global *glob, uint64_t amount, bool reserve) { uint64_t free_swap_mem = get_nr_swap_pages() << (PAGE_SHIFT - 1); - uint64_t limit; + uint64_t swap_glob_mem, limit, total_used_mem; + struct ttm_mem_zone *zone; int ret = -ENOMEM; unsigned int i; - struct ttm_mem_zone *zone; + + swap_glob_mem = atomic64_read(&glob->swap_glob_mem); spin_lock(&glob->lock); /* adjust the max_swap_mem to cover the new inserted swap space */ @@ -493,7 +495,9 @@ static int ttm_mem_global_reserve(struct ttm_mem_global *glob, limit = (capable(CAP_SYS_ADMIN)) ? zone->emer_mem : zone->max_mem; - if (zone->used_mem > limit) + total_used_mem = zone->used_mem + swap_glob_mem; + limit += glob->max_swap_mem; + if (total_used_mem > limit) goto out_unlock; } diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 95a77da..5d441e0 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -183,8 +183,11 @@ void ttm_tt_destroy(struct ttm_tt *ttm) ttm_tt_unpopulate(ttm); if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP) && - ttm->swap_storage) + ttm->swap_storage) { fput(ttm->swap_storage); + atomic64_sub_return(ttm->num_pages << PAGE_SHIFT, + &ttm->glob->mem_glob->swap_glob_mem); + } ttm->swap_storage = NULL; ttm->func->destroy(ttm); @@ -322,8 +325,11 @@ int ttm_tt_swapin(struct ttm_tt *ttm) put_page(from_page); } - if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP)) + if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP)) { fput(swap_storage); + atomic64_sub_return(ttm->num_pages << PAGE_SHIFT, + &ttm->glob->mem_glob->swap_glob_mem); + } ttm->swap_storage = NULL; ttm->page_flags &= ~TTM_PAGE_FLAG_SWAPPED; @@ -383,6 +389,9 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage) ttm->page_flags |= TTM_PAGE_FLAG_SWAPPED; if (persistent_swap_storage) ttm->page_flags |= TTM_PAGE_FLAG_PERSISTENT_SWAP; + else + atomic64_add_return(ttm->num_pages << PAGE_SHIFT, + &ttm->glob->mem_glob->swap_glob_mem); return 0; out_err: diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h index ad5a557..6282b50 100644 --- a/include/drm/ttm/ttm_memory.h +++ b/include/drm/ttm/ttm_memory.h @@ -50,6 +50,7 @@ * @lock: Lock to protect the @shrink - and the memory accounting members, * that is, essentially the whole structure with some exceptions. * @max_swap_mem: upper limit of swap space TTM can use + * @swap_glob_mem: total size of ttm pages which have been swapped out * @zones: Array of pointers to accounting zones. * @num_zones: Number of populated entries in the @zones array. * @zone_kernel: Pointer to the kernel zone. @@ -69,6 +70,7 @@ struct ttm_mem_global { struct work_struct work; spinlock_t lock; uint64_t max_swap_mem; + atomic64_t swap_glob_mem; struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES]; unsigned int num_zones; struct ttm_mem_zone *zone_kernel;