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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFF22C4363D for ; Fri, 25 Sep 2020 02:48:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6B072206FB for ; Fri, 25 Sep 2020 02:48:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B072206FB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C8E326B005C; Thu, 24 Sep 2020 22:48:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3F256B005D; Thu, 24 Sep 2020 22:48:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2EB06B0062; Thu, 24 Sep 2020 22:48:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0082.hostedemail.com [216.40.44.82]) by kanga.kvack.org (Postfix) with ESMTP id 9E24D6B005C for ; Thu, 24 Sep 2020 22:48:03 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 57687180AD801 for ; Fri, 25 Sep 2020 02:48:03 +0000 (UTC) X-FDA: 77300049246.06.bird72_1a1511c27164 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 35AFF1019F8A1 for ; Fri, 25 Sep 2020 02:48:03 +0000 (UTC) X-HE-Tag: bird72_1a1511c27164 X-Filterd-Recvd-Size: 3179 Received: from huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Sep 2020 02:48:02 +0000 (UTC) Received: from dggeme752-chm.china.huawei.com (unknown [172.30.72.55]) by Forcepoint Email with ESMTP id 0E2D0C137D03431F3A16; Fri, 25 Sep 2020 10:47:59 +0800 (CST) Received: from dggeme753-chm.china.huawei.com (10.3.19.99) by dggeme752-chm.china.huawei.com (10.3.19.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Fri, 25 Sep 2020 10:47:58 +0800 Received: from dggeme753-chm.china.huawei.com ([10.7.64.70]) by dggeme753-chm.china.huawei.com ([10.7.64.70]) with mapi id 15.01.1913.007; Fri, 25 Sep 2020 10:47:58 +0800 From: linmiaohe To: Andrew Morton CC: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] mm/mempool: Add 'else' to split mutually exclusive case Thread-Topic: [PATCH v2] mm/mempool: Add 'else' to split mutually exclusive case Thread-Index: AdaS5faxg3FHsPPEQpeRvHY4DCGK8w== Date: Fri, 25 Sep 2020 02:47:58 +0000 Message-ID: <3cc5c0cd2eef450ca8d8843ab72edc98@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.176.109] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000461, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Andrew Morton wrote: > On Thu, 24 Sep 2020 07:16:41 -0400 Miaohe Lin wrot= e: > >> Add else to split mutually exclusive case and avoid some unnecessary che= ck. >> It doesn't seem to change code generation (compiler is smart), but I=20 >> think it helps readability. > > OK, I guess. But the comments are now in the wrong place. > Many thanks for kindly reply and fix the wrong comments place. Have a good day! > --- a/mm/mempool.c~mm-mempool-add-else-to-split-mutually-exclusive-case-f= ix > +++ a/mm/mempool.c > @@ -60,8 +60,8 @@ static void check_element(mempool_t *poo > /* Mempools backed by slab allocator */ > if (pool->free =3D=3D mempool_free_slab || pool->free =3D=3D mempool_kf= ree) { > __check_element(pool, element, ksize(element)); > - /* Mempools backed by page allocator */ > } else if (pool->free =3D=3D mempool_free_pages) { > + /* Mempools backed by page allocator */ > int order =3D (int)(long)pool->pool_data; > void *addr =3D kmap_atomic((struct page *)element); > =20 > @@ -83,8 +83,8 @@ static void poison_element(mempool_t *po > /* Mempools backed by slab allocator */ > if (pool->alloc =3D=3D mempool_alloc_slab || pool->alloc =3D=3D mempool= _kmalloc) { > __poison_element(element, ksize(element)); > - /* Mempools backed by page allocator */ > } else if (pool->alloc =3D=3D mempool_alloc_pages) { > + /* Mempools backed by page allocator */ > int order =3D (int)(long)pool->pool_data; > void *addr =3D kmap_atomic((struct page *)element); > =20 > _ > >