Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp209813lqp; Tue, 11 Jun 2024 01:57:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKdQMKsVHvKCU6pozP7zrtHxbAGrKXpClb4E++sJ9zs9RcXFMeW4aurRLndUgrCkXM9FUrTmWyoOGo9l62M+xjVppUqtD/hIiCdl2brw== X-Google-Smtp-Source: AGHT+IEqfLcQ/OZuII6tXVwwirZtUBXkYcaFmpqcnD65yZX6uHuf6+1YOvoRYETZseu0iFUXFSbO X-Received: by 2002:a05:6214:3117:b0:6b0:839e:ba6b with SMTP id 6a1803df08f44-6b0839ebf72mr38127086d6.43.1718096254285; Tue, 11 Jun 2024 01:57:34 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6b088f4d176si20567396d6.333.2024.06.11.01.57.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 01:57:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209534-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b="jKzzt7P/"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-209534-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209534-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E7E4E1C20F1A for ; Tue, 11 Jun 2024 08:57:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 511B6176228; Tue, 11 Jun 2024 08:56:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="jKzzt7P/" Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2068.outbound.protection.outlook.com [40.107.215.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E5A617557E for ; Tue, 11 Jun 2024 08:56:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.68 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718096210; cv=fail; b=kcuPQJTNVq81de+fLOE4jir2p2PlHuTOYzDADANQeV1Df+P4AayMuA6el2PTugbsnYkyjCbX7/EXSCDiWhaftEb1KjvrFyWILY3m/9U6HxDxctrOQrtQVgLGimmS4Y7BvI5yrWoN6rlmt0TspMLgQMVNHapKtDcOqhkbyv7uJYo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718096210; c=relaxed/simple; bh=RVyURmoeXZIp4B85tUH39SG6CHcL6Sx/0e8Axiw0bIQ=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=CIrUyjmu2S4bLP9bUY1T2n/6HnjSnYS7UC7HQC1wPDP0Na6HuPopUiPQPsncuCKzzv7GNNx0Ol41SyaK+LSgMFR9a38QWumrda6rVMTQnM2KDz1vbN4TCg3WsW0cbZIQ04WBVGSShcf7uUgk7PQe02Z2ISQFEZAtzHfqah8KyYg= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=jKzzt7P/; arc=fail smtp.client-ip=40.107.215.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VE2S+KLAjiji+Hqx5WKh7Tsjk4QG9VEi5e+xKbnEOmTPAW17eNsjthypEPHRK6qQfE3JEAMYYFOBhTc2bs4ETm/6huzsUHHP69uC8sdEUVjKWUvHBlWsISuciVPIIZEkuRYvqifKTjRNIHH7ZXnycoPabffh1Owsb6MCNC5oXpdALJPciRJz7trqe2+4LUPCjm2vvOwatOo6+jOpzkk41MMX/jvKHUXByNlZxTQ8ckNehW6y1GUw0fphE3eQqx6h5JH/7ee/bZDt6jtSsMxvoPqnoTSu0mz42erH8eoxqLkdpLB3oAne5Pp7/fiVVBNt7PODvXtN8kIdqP1nqYCVbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ERo6iNzYR8gGMDOMiAjuaEX1EaLcBOfNZOofX3ovnns=; b=RVUiNqBzxpt/+c4yQM/OQnY7eJ6l+y2cuXqWKu3wL88NyKRP17WIlGXZwTBCJC1HkkfhxEQWrXCPrnalyxY+d52D2uN9Mn1614md3WX+dkI7BeBg1pVC3LbTxPSk4K+ycv5iu72D9dcSUXBoouNrieOT8ospCf1SxOYxRNgOUykGTtW8y3UbWCohmmeRzTNAd1FFGhVg7Belxkd//+eYqTOMdIcQIBlyMaWsHtOfuVifTCdrt0b60KlHsuadyrw3hvCsWt9YFBjzr8FLnJLw+6RNwzJwmJj+6+sXj00agFA3/OJRMOlGJKi+u3ShGzB6Jz/O4J4JarWCcuu10Mjouw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ERo6iNzYR8gGMDOMiAjuaEX1EaLcBOfNZOofX3ovnns=; b=jKzzt7P/0W15yfU4NlOFGP0mXSb3Ta3nN6vgQpbvjEenLy9cdunp8cNWK50pn9twzeicSTm7dkFGJLbTtuz0xlqSGBRmLc/kjlS8cXERtrZLJv/yyuzuvEop1T5D23folqd/ZCkNodtjgKRn0sXVEcOOERfve85OWD9wedk7S6JhDOyP+K3nx4y0MPM6ACXHxersV9rK3LBBsSnoQIfzOgAq3iiJxguCmr7zUkn5sj4IBcW1RE6qdE5zd/9k2y2BjFSaC7QIOd5aQDNcbMUMHV4brCPM4uatarZxNH8SV9UbkrXd8YtNZYYrIU+7ncx2pmaskP+s6bQLiHudeAZ8Bw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) by PUZPR06MB5827.apcprd06.prod.outlook.com (2603:1096:301:e9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Tue, 11 Jun 2024 08:56:43 +0000 Received: from SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd]) by SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd%5]) with mapi id 15.20.7633.036; Tue, 11 Jun 2024 08:56:42 +0000 From: Lei Liu To: Greg Kroah-Hartman , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Carlos Llamas , Suren Baghdasaryan , linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH] binder_alloc: replace kcalloc with kvcalloc to mitigate OOM issues Date: Tue, 11 Jun 2024 16:56:28 +0800 Message-Id: <20240611085629.25088-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: TYCP286CA0269.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:455::20) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|PUZPR06MB5827:EE_ X-MS-Office365-Filtering-Correlation-Id: a4d30235-2e8c-4944-d053-08dc89f469df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|52116005|376005|1800799015|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?B?QnIvcjdIbVAwMWhaMUFqbHl2UlFlVjF6WFRHZzlJVmFvYmcyOXJkVk9DSmM3?= =?utf-8?B?Nmh2UGxYL28yUWk5MUFKWGkwSDlPazF1Qnl4dDdqWnl3aDdDQTJxM2RIOUVw?= =?utf-8?B?cXVCbGh4MFMySURWK3NmbUp0R1FMMUV5ZkZtNmNEVkJiTVY3ak1qVzdBZE9v?= =?utf-8?B?L1ppbTVhRkIwbHdHNFhWR0RQbjVoZ25QK25NTzlyanlKcThnL1lSVUo1dGNu?= =?utf-8?B?K2t3bUZFd083VXo2OFkvMWdrRHNCcVYyQWkyWjEzSis4MVNPSVlCalJWNzVx?= =?utf-8?B?Tmt5UzBHY1NrVWczcWtObi9vdTJjQzY3SWRWcFF3U2FYeFlkazVJ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xzckl1NlUzL05SYnB6ZEk4TGlSbkNp?= =?utf-8?B?SmhuMzc0MHRZWEQ4a0JBeU5FbzBqaStXNmFReVVISisyV0h5VFlXbmZwK24r?= =?utf-8?B?UElRRlh2VGk3d3hqTktxdXY5T1NoNEI0ejN0eFVPekJXT0hmUXBvN3BDU2hJ?= =?utf-8?B?N3ZtQ0RhUWo1N2RLbFZxd04vNzlUa1Fkdkc1ZUZNVUV5dXhHWmlTdXJBeVNi?= =?utf-8?B?bGRjNEdqMU9pS1IyOXdEVFk2SUo2OGVKQUdNOG5mMDZnc2dTanc4eXc2Wm1K?= =?utf-8?B?OXRFSGM5VUgrM2lZU0s0bGJQWmtzaFdycWwrZm5raUtzeVROYjdEZWd5ZXlO?= =?utf-8?B?dUU1Z1loTUNaenI1UkdCcFVwWnpnZnYycDJJNmQ5dm1sQmhITHVSaEtGeTcr?= =?utf-8?B?RG9QQkVpaHdvN2FsNjVlcUNNcUNDVEwzS2JFZEsxOXowejBaakJ1Z3U0QmpV?= =?utf-8?B?R25iWm9GTUw2UGxHSjdPUjV5WlVMdFI4VjZPd0F1dWpzQmFTUXNqcUYvdG11?= =?utf-8?B?enZ3dVpqUXNjVWhkTStFRU5zMUxGYSs4YUtBNkdrcGpoQU9WQWpHM2xIeXU5?= =?utf-8?Q?quQtoq1HPjH5QlEJK4J2Hh/EZ5nNDN1NkHyq8=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5624.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(52116005)(376005)(1800799015)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RzBKYWRQOFM5Z01mU0lLYXMxVUN4NVJYL1dSanB3bDc0RzFLdjdlNEVYMFlG?= =?utf-8?B?WnBuQ1h3L2FDZEJ5N25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aaE9wL0J0?= =?utf-8?B?dHByYzFCOCtsWHYxVG1mYjYwdEVUQURqSEJLWk9yQzJod3ZncEJ3ZDhKY3dG?= =?utf-8?B?eGFwZ2xRcXZiVWgwWE4rY1RQNlZBMFJwYkdTd0F5eThkdGlsS1RidHhianZh?= =?utf-8?B?S2hRSTc2UVAxMGppYjNhVG9NK29YK3RmdXpBN251aDFNVUpXRloySFdLdUk4?= =?utf-8?B?aVNMNE0zOTY4RkhPTkJYd0NsVllQckROYzFwcjF4dDcvN0gvK0xBRm5FTDMw?= =?utf-8?Q?CSRokSz4AbjtZebZsLc4x1RdN?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4d30235-2e8c-4944-d053-08dc89f469df X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2024 08:56:42.2952 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6/EU5b655p7GjCgNjErNH4ojri5jq0ExzjhGNYBZhgyRAWlCZaPCtmrazHjgI7php3eW4nP8SsTHKDGGrFAl6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5827 In binder_alloc, there is a frequent need for order3 memory allocation, especially on small-memory mobile devices, which can lead to OOM and cause foreground applications to be killed, resulting in flashbacks. We use kvcalloc to allocate memory, which can reduce system OOM occurrences, as well as decrease the time and probability of failure for order3 memory allocations. Additionally, it can also improve the throughput of binder (as verified by Google's binder_benchmark testing tool). We have conducted multiple tests on an 8GB memory phone, and the performance of kvcalloc is better. Below is a partial excerpt of the test data. throughput = (size * Iterations)/Time Benchmark-kvcalloc Time CPU Iterations throughput(Gb/s) ---------------------------------------------------------------- BM_sendVec_binder-4096 30926 ns 20481 ns 34457 4563.66↑ BM_sendVec_binder-8192 42667 ns 30837 ns 22631 4345.11↑ BM_sendVec_binder-16384 67586 ns 52381 ns 13318 3228.51↑ BM_sendVec_binder-32768 116496 ns 94893 ns 7416 2085.97↑ BM_sendVec_binder-65536 265482 ns 209214 ns 3530 871.40↑ Benchmark-kvcalloc Time CPU Iterations throughput(Gb/s) ---------------------------------------------------------------- BM_sendVec_binder-4096 39070 ns 24207 ns 31063 3256.56 BM_sendVec_binder-8192 49476 ns 35099 ns 18817 3115.62 BM_sendVec_binder-16384 76866 ns 58924 ns 11883 2532.86 BM_sendVec_binder-32768 134022 ns 102788 ns 6535 1597.78 BM_sendVec_binder-65536 281004 ns 220028 ns 3135 731.14 Signed-off-by: Lei Liu --- drivers/android/binder_alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 2e1f261ec5c8..5dcab4a5e341 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -836,7 +836,7 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, alloc->buffer = vma->vm_start; - alloc->pages = kcalloc(alloc->buffer_size / PAGE_SIZE, + alloc->pages = kvcalloc(alloc->buffer_size / PAGE_SIZE, sizeof(alloc->pages[0]), GFP_KERNEL); if (alloc->pages == NULL) { @@ -869,7 +869,7 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, return 0; err_alloc_buf_struct_failed: - kfree(alloc->pages); + kvfree(alloc->pages); alloc->pages = NULL; err_alloc_pages_failed: alloc->buffer = 0; @@ -939,7 +939,7 @@ void binder_alloc_deferred_release(struct binder_alloc *alloc) __free_page(alloc->pages[i].page_ptr); page_count++; } - kfree(alloc->pages); + kvfree(alloc->pages); } spin_unlock(&alloc->lock); if (alloc->mm) -- 2.34.1