Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2630038ybg; Thu, 24 Oct 2019 12:41:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqykfU706qIbRZmMSp/M4HW7Qzq789K1YGy5qrXlncf057mr65XL5lMDVDu8dHJ8a0S2x36r X-Received: by 2002:a17:906:6bcd:: with SMTP id t13mr28591952ejs.231.1571946089402; Thu, 24 Oct 2019 12:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571946089; cv=none; d=google.com; s=arc-20160816; b=sKtmyTQPiUIlMLsWoK4I/R6lTzW9YunEKLMrgIZ9jed1khFdGdhhzdh+uTTp7H9KUA Lpctc9yogkdmwUHIbhRHW6K+fXnUBPTOa9g/6EMEut0VMnHbT4N8o4y+03jx6ux72kde RZldrEbfDvwy2zsXbp2XLXSQ5tkbce5jY01toP52tMf5tqfJwegSWbu4jvr+IjNPLATD UPSvQzADrL9O9nLejgpWLqH1VPNPzqgbgq1xYZpEt6XxTwaWlp/BPpsaty4wnnQXBMks IoK7tZm7nzhrELLZC2vvUaOXu67xYZSugeyHNmTV62UDL2jKZfP58j1EtpUlbd45iAcc UW6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=VwBF6p1M8927Odbh5I821hXB1ZqOPhXq8rXeu1h0xwA=; b=SqChPoXoGpbQ+bQ/WoeCUPvicx6oKQIunaJl17nY2QVtiiN1MKA0p0d3VOcWGVzuAg hUrzWQ4im0VdiToVfitxCjRW0ae0A2FH3BhGgfBBsFeF91ief/X35v0xH71yDN4a8Lxi sKfc119z/yMV1HWGaBDXreFW+Am1En3uuEz5FOA301x3x6eBPfGt/JHwT+1uycCrHK+z YUUUQkGMViVsM7x42+OX+DjDYCdN6aVxC5fKWcTUNB99yLeiPUkZ127z1ecmd0uSByQ3 FJ9fpyZC8MIViwgEttBjBA/eR1mG4ff1ud87syw9iqSh6wfFZ8phR3kpVOOwGEXZQcMY Whxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si1386711ejr.440.2019.10.24.12.41.05; Thu, 24 Oct 2019 12:41:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437166AbfJXCpe (ORCPT + 99 others); Wed, 23 Oct 2019 22:45:34 -0400 Received: from mx1.unisoc.com ([222.66.158.135]:15959 "EHLO SHSQR01.spreadtrum.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2437146AbfJXCpe (ORCPT ); Wed, 23 Oct 2019 22:45:34 -0400 Received: from ig2.spreadtrum.com (bjmbx02.spreadtrum.com [10.0.64.8]) by SHSQR01.spreadtrum.com with ESMTPS id x9O2iCEv054828 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Thu, 24 Oct 2019 10:44:12 +0800 (CST) (envelope-from Chunyan.Zhang@unisoc.com) Received: from localhost (10.0.93.106) by BJMBX02.spreadtrum.com (10.0.64.8) with Microsoft SMTP Server (TLS) id 15.0.847.32; Thu, 24 Oct 2019 10:44:26 +0800 From: Chunyan Zhang To: Steven Rostedt , Ingo Molnar CC: , Yuming Han , Chunyan Zhang Subject: [PATCH] tracing: use kvzalloc for tgid_map array allocation Date: Thu, 24 Oct 2019 10:39:33 +0800 Message-ID: <1571884773-23990-1-git-send-email-chunyan.zhang@unisoc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.93.106] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX02.spreadtrum.com (10.0.64.8) X-MAIL: SHSQR01.spreadtrum.com x9O2iCEv054828 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yuming Han Fail to allocate memory for tgid_map, because it requires order-6 page. detail as: c3 sh: page allocation failure: order:6, mode:0x140c0c0(GFP_KERNEL), nodemask=(null) c3 sh cpuset=/ mems_allowed=0 c3 CPU: 3 PID: 5632 Comm: sh Tainted: G W O 4.14.133+ #10 c3 Hardware name: Generic DT based system c3 Backtrace: c3 [] (dump_backtrace) from [](show_stack+0x18/0x1c) c3 [] (show_stack) from [](dump_stack+0x84/0xa4) c3 [] (dump_stack) from [](warn_alloc+0xc4/0x19c) c3 [] (warn_alloc) from [](__alloc_pages_nodemask+0xd18/0xf28) c3 [] (__alloc_pages_nodemask) from [](kmalloc_order+0x20/0x38) c3 [] (kmalloc_order) from [](kmalloc_order_trace+0x24/0x108) c3 [] (kmalloc_order_trace) from [](set_tracer_flag+0xb0/0x158) c3 [] (set_tracer_flag) from [](trace_options_core_write+0x7c/0xcc) c3 [] (trace_options_core_write) from [](__vfs_write+0x40/0x14c) c3 [] (__vfs_write) from [](vfs_write+0xc4/0x198) c3 [] (vfs_write) from [](SyS_write+0x6c/0xd0) c3 [] (SyS_write) from [](ret_fast_syscall+0x0/0x54) Switch to use kvzmalloc to avoid unexpected allocation failures. Signed-off-by: Yuming Han Signed-off-by: Chunyan Zhang --- kernel/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 6a0ee9178365..2fa72419bbd7 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -4609,7 +4609,7 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled) if (mask == TRACE_ITER_RECORD_TGID) { if (!tgid_map) - tgid_map = kcalloc(PID_MAX_DEFAULT + 1, + tgid_map = kvcalloc(PID_MAX_DEFAULT + 1, sizeof(*tgid_map), GFP_KERNEL); if (!tgid_map) { -- 2.20.1