From patchwork Wed Nov 9 09:44:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Wensheng X-Patchwork-Id: 17433 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp244066wru; Wed, 9 Nov 2022 01:52:52 -0800 (PST) X-Google-Smtp-Source: AMsMyM6h+/VX2dB8crUcehMFazou6Y1Q6HlR7qvgXx6EUY7vyabVTAodnT75YhUycwWUdS0LdR+A X-Received: by 2002:a65:5386:0:b0:46e:dbd3:413 with SMTP id x6-20020a655386000000b0046edbd30413mr50137162pgq.240.1667987572142; Wed, 09 Nov 2022 01:52:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667987572; cv=none; d=google.com; s=arc-20160816; b=pYEhqIbHPXY8wnRcSXb4rkXp1pnlL1Ztr023Cn7aN5pKXkOe3IVqcseEUOnYaZA+/V yL56OShqFSK5FeXTKUGwj08D1CeLG9mVwhAQ7CLUOa9hFYISPnko3BigMNrcrpd085gr 3sBzakbp0pS+fdEX4MAgPMOxGJx5G7TIJcxkNm6u9A+6LLQt3bhiis00UTXvUe5st5a2 bxn/HMegW225lFqB3VAXlvxo8OrSyrzbelnul8ktYXXcfki07lPxfoYf8sfpTSedyNoB ykICxvcyjzwmQu3FdixWLFTrVBAfzjYtgn5fOlvoeCjHQf2Ti9XgaUOuoN2CakHmXc9X GVYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=TTgErEyP1HSDU488b1ax5SPVOwdIdpQ1HCqBOJ2JW10=; b=SgXjlv8L7xQALw599xntF95RhiDw6fIeaP3rgP7Zmsx81lwj2/CpCW3jHbeZkHjIwj zP5A7oxwagGvSM22/+QEickrr8GA3f8lDOKwcOAjtw9bEvpR09asjnXbD4lxr62uhav4 Agvxe2/w6fjLwzgT9eBNxRADY5TZ/ejisDrl0jGt5rCGXWD94c4e1H+qEDNYLLboV3IW 8TP0gGFTlkHxdHqr+keha8VMbvJ/3okUqWIWPN3KQgUU5LGzlLAsv0bNIMIMwDJ+eT0G nujjGxImUhQjwXyCBbaHggQOXoOvFHc95PYxz35yNBnqyoO1EKXoGe2HoBkvzCxYlXY/ D3tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c30-20020a630d1e000000b0046f063f5498si18207127pgl.58.2022.11.09.01.52.39; Wed, 09 Nov 2022 01:52:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbiKIJqS (ORCPT + 99 others); Wed, 9 Nov 2022 04:46:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbiKIJqO (ORCPT ); Wed, 9 Nov 2022 04:46:14 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFDAD23160 for ; Wed, 9 Nov 2022 01:46:12 -0800 (PST) Received: from kwepemi500015.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N6g856WSRzmVln; Wed, 9 Nov 2022 17:45:57 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500015.china.huawei.com (7.221.188.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 9 Nov 2022 17:46:10 +0800 From: Wang Wensheng To: , , , CC: , , Subject: [PATCH -next 2/3] ftrace: Optimize the allocation for mcount entries Date: Wed, 9 Nov 2022 09:44:33 +0000 Message-ID: <20221109094434.84046-3-wangwensheng4@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221109094434.84046-1-wangwensheng4@huawei.com> References: <20221109094434.84046-1-wangwensheng4@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500015.china.huawei.com (7.221.188.92) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749011736407975824?= X-GMAIL-MSGID: =?utf-8?q?1749011736407975824?= If we can't allocate this size, try something smaller with half of the size. Its order should be decreased by one instead of divided by two. Signed-off-by: Wang Wensheng --- kernel/trace/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index c571c2813c11..43a958b28022 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -3200,7 +3200,7 @@ static int ftrace_allocate_records(struct ftrace_page *pg, int count) /* if we can't allocate this size, try something smaller */ if (!order) return -ENOMEM; - order >>= 1; + order--; goto again; }