From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA2AFC433EF for ; Thu, 16 Jun 2022 03:22:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 235DC6B0072; Wed, 15 Jun 2022 23:22:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E4F16B0073; Wed, 15 Jun 2022 23:22:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0AD5B6B0074; Wed, 15 Jun 2022 23:22:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id ECE3E6B0072 for ; Wed, 15 Jun 2022 23:22:03 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B8C0421319 for ; Thu, 16 Jun 2022 03:22:03 +0000 (UTC) X-FDA: 79582650126.10.D989EF2 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf19.hostedemail.com (Postfix) with ESMTP id B9E321A008F for ; Thu, 16 Jun 2022 03:22:02 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LNnV54cM1z1K9QT; Thu, 16 Jun 2022 11:19:57 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 16 Jun 2022 11:21:56 +0800 Subject: Re: [PATCH] mm/page_alloc: make calling prep_compound_head more reliable To: Matthew Wilcox CC: Joao Martins , Andrew Morton , , , Dan Williams References: <20220607144157.36411-1-linmiaohe@huawei.com> <20220607113257.84b1bdd993f19be26b8c4944@linux-foundation.org> <65e5da9c-32d1-17d7-d8c6-96cbfac23fec@oracle.com> <4a30f026-789a-9235-2fbd-f553e4d7b45d@huawei.com> <40a07ce5-414a-a3b8-53ee-6c348635f03a@huawei.com> From: Miaohe Lin Message-ID: <1483de08-321c-41da-e098-8defd6ae4f11@huawei.com> Date: Thu, 16 Jun 2022 11:21:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655349723; a=rsa-sha256; cv=none; b=njwTUZAwjeJSvbQ9nm6e3TD+ye3uXfs5HNMCurvTjEeuwwmrYZzjiqcW2hqJNpJhpe4ZzV QexizaC2tUUhuAKsfyDtWqFr9vTTlXVSFI0u362zKUT6RYV+y2tw2hrR3VThi9u0GlBK0d FbBJubC9wzZrHYTW1Abs+sAFX2UBrKM= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655349723; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2vFCbt7GMFyjnjMjSILkHiohSUjgUkpMG5V5tuWOccw=; b=qsYTvvghq11PbCATnpfMwwzf3u0/WW9cFPXh/YgL68NqLxqaDGXyy93OkMVhh12imuVL0M 4DCel071tqvB6l7Myjq9KXAHcvPJnuApQcsvgnKLjvLWYDzc8CbRdbF7ZGAtd5Qcx1feSg XUDxxdghglEMtjLjcRq3sh3bvmoeJ7Y= X-Stat-Signature: j5igezeht1qe15zzo9agfo41j7banbeu X-Rspamd-Queue-Id: B9E321A008F Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1655349722-305668 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/6/15 20:42, Matthew Wilcox wrote: > On Wed, Jun 15, 2022 at 03:44:06PM +0800, Miaohe Lin wrote: >>> We definitely don't need the unlikely here. >> >> Could you please give me a more detailed explanation? IIUC, the above if condition >> will only meet at a probability of 1/512. So unlikely tells the compiler to do some >> optimization around it. Or am I miss something? > > Only add unlikely() when the compiler can't figure out for itself that > it's unlikely. You should also check the generated code and/or > benchmark the results to be sure that it's actually an improvement. > Using unlikely() needs to be backed up with more than just a feeling. I see. Many thanks for clarifying. Will keep it in mind. :) > > . >