Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2639522ybg; Thu, 24 Oct 2019 12:51:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwURFpiD4aHCYhHJ24l3wvgPkipV8cfvlDmAn+irM7e7pO8XHu3n+bnxMjDw/5khUHntHj5 X-Received: by 2002:aa7:d3c4:: with SMTP id o4mr3976edr.194.1571946713431; Thu, 24 Oct 2019 12:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571946713; cv=none; d=google.com; s=arc-20160816; b=bLc5ndDGAu2IeIUC2+y/kS5xil/Tmvtyh//nqNIKcbysUvAtv3gIZlSoprpBB3dxU8 siAdux9yWTjxQR6JtxsuWWljbrTPTr7SBlIQaGQF5m25XCuR19lqyXdDmNB2zoI3b5PL KZM14UDfnj45MwkRpt+xHMzvQmkMPhu0buxXICQIolIcbQ+jhm49jmB7xux3BLSpDR0p eyPcENHuWEQJLiDefV4KnUG8ST67WdaXAFfavAtASV+Vw+GB4kty9GzQW0a5v9oLfjCI /bAsGkxeYO4EzPiCh7YjPPENf2ouDErAnU1ThSP3CkPUKsiXobNuK3BXEOKcIHoVf9zA S/zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=IeLHtMDvKwKfYPQnUQspqaByh17FQEJmwBCqPbG61wY=; b=VxoldqTAvbBaoSeKmdh4aDGB3KNkJXBK5WC+vcqBHu+H3cD3az0NwiQvTC1zsuABvQ yZHffyW+28EHLfMWbI8VCi2T6on3/JZYjhkWqdWMPGER69hm/HEXb6M3Aa8BGdVHTeHI oxzo+gNHdmZDufRipruY8dJfNEIuxm7XNH3KtMVdVeluDSvLxBEkA6um2k/E/uScvTwV FHmNdjaacxrVhKzQHcAXGT8yJv7Ij4zhLPy8EmI17cZ/JmKC7+ihhl+0qHESlxBegurx AyD/mC5o6A9irkHefeVU73WN536VzjtPmygjV8otg98fZHEbuF5L4Y2IMonl2Y2abf34 VYeg== 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 17si14379954ejx.213.2019.10.24.12.51.29; Thu, 24 Oct 2019 12:51:53 -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 S2437318AbfJXDfs (ORCPT + 99 others); Wed, 23 Oct 2019 23:35:48 -0400 Received: from mx1.unisoc.com ([222.66.158.135]:45203 "EHLO SHSQR01.spreadtrum.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2392415AbfJXDfr (ORCPT ); Wed, 23 Oct 2019 23:35:47 -0400 Received: from ig2.spreadtrum.com (bjmbx02.spreadtrum.com [10.0.64.8]) by SHSQR01.spreadtrum.com with ESMTPS id x9O3YLUh004509 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Thu, 24 Oct 2019 11:34:21 +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 11:34:35 +0800 From: Chunyan Zhang To: Steven Rostedt , Ingo Molnar CC: , Yuming Han , Chunyan Zhang Subject: [PATCH] tracing: use kvcalloc for tgid_map array allocation Date: Thu, 24 Oct 2019 11:34:30 +0800 Message-ID: <1571888070-24425-1-git-send-email-chunyan.zhang@unisoc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1571884773-23990-1-git-send-email-chunyan.zhang@unisoc.com> References: <1571884773-23990-1-git-send-email-chunyan.zhang@unisoc.com> 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 x9O3YLUh004509 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 kvcalloc 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