Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp334639rwb; Wed, 9 Nov 2022 03:12:46 -0800 (PST) X-Google-Smtp-Source: AMsMyM49UMqx/+iOVvjr5HO5AA1aO+6ukgi6BxC2/IhTA6gG3iBbE6xQ356pG2UfaLhm+joUm54k X-Received: by 2002:a17:90a:d396:b0:214:2cff:fbb6 with SMTP id q22-20020a17090ad39600b002142cfffbb6mr38301585pju.224.1667992365845; Wed, 09 Nov 2022 03:12:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667992365; cv=none; d=google.com; s=arc-20160816; b=VEH/FbQLtG32BRkxQgCjSdURzYnTimmnxwmEX+Rw+L95W3PIkX0q+PY+wf1DIPLsDa AJMaRHVrq/dLS74pGeM7TzZf5VAhFu5ehLGWT74YGoBoGXwSK7GsPveHHZCWs6DDtikT YAltUQIiiLeHOZHFcz+QoehMfc8hZng74ImBPVmxuIdEPR5nGEPveRNYCI8/h16VX0jU 8UWTZzHp6ERtWMod6u8AS7xNgZCzKprH9bvBUUGRHMWD3doDHH8LDhmtUyVrooa7ro2p wscEBC1+oKjeQEOgnESDY4kd2N0cNUNqj/vNQeyTpa5SvlXXvKJRsimhGk/MtCP88jBP 5f8A== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y21-20020a631815000000b0042bc6e8d3f7si16815118pgl.642.2022.11.09.03.12.33; Wed, 09 Nov 2022 03:12:45 -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 + 93 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 Content-Type: text/plain 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 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; } -- 2.17.1