From patchwork Sun Nov 4 12:50:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 10666859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B4F5175A for ; Sun, 4 Nov 2018 12:50:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 147EE29927 for ; Sun, 4 Nov 2018 12:50:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E19CF2993D; Sun, 4 Nov 2018 12:50:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A1D129927 for ; Sun, 4 Nov 2018 12:50:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5491E6B0003; Sun, 4 Nov 2018 07:50:34 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4F8816B0005; Sun, 4 Nov 2018 07:50:34 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E8BB6B0007; Sun, 4 Nov 2018 07:50:34 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id F13E36B0003 for ; Sun, 4 Nov 2018 07:50:33 -0500 (EST) Received: by mail-pl1-f200.google.com with SMTP id 33-v6so6714899pld.19 for ; Sun, 04 Nov 2018 04:50:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=q0IjlPdLyA3cEWBQiuNF0SAFheYmblsEgu7HJ3hDm6g=; b=lVThoNmoCH0f9xEXabEbjnI+LnqC4UsK0j66Xql4ee1qYcCCemPya3z35tMrVFav6/ 5xlvTfy2aPvs/Jh0GHdI/eGD36peqrhbqL6Oo+fBRsaj2a6puZviroch9dOn5RIocm+e yGpPE/0PzANZMK/smqEjuVamiBhZhR1xEX9c9v+BiH//n015Uu0M/BdoWuRIBf1Gf8d0 oBYHoySkjf1tv5sHl9lktki9TzTs75i/9X4QDVLJsIzZr7oGpBcT5LNxgnfsCrw1N5L3 kggdm6qZexMvJ+ks45lSnqJwY88iyKRad0y41LSBQgY4/RCljzi2oIppd8gvPT/61G3F mw2Q== X-Gm-Message-State: AGRZ1gKuFR15TdND9l+f8zyvUusOcpx8IKIaENrX0nJjiaIF++oP+oTb emz202WSzC0l7ZxSfog4K4UbffT/3DsE6/32iZR4TxTCTvUmdGjH0niukftzI32q4BFPv26t9nJ 9c0z66/Kq7NV77y4yJTRKK4X5/yybGrLgIf+V03ze2uFHTdItIRaNr24AzLsl4TPcDWFpXYECYE 2JoQUX+idiB4QZAxhfVHq0gI6OA6JQerwl9+Msp4UdA8Ol3yq1hbALXSyPraYckYu8GMQki/4Cr qk55Sm45kezgArQAsqPsOZiLNrUX3xpge92/SoJQEWW2Ah/OvcO+t2GEhlE43uoF/a5/kwLCoFS JAJkczbxeS6cuUxV4HsvR33zlhHH20WG7Bg0h4lT/szzJ6CHcV7LLTNZ8cUc8wlM8pzK4Mj3cib y X-Received: by 2002:a65:4683:: with SMTP id h3mr16118267pgr.225.1541335833607; Sun, 04 Nov 2018 04:50:33 -0800 (PST) X-Received: by 2002:a65:4683:: with SMTP id h3mr16118243pgr.225.1541335833049; Sun, 04 Nov 2018 04:50:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541335833; cv=none; d=google.com; s=arc-20160816; b=ECRyeQVkZCMVRnwiHH9Wl9qt6/WgM9M02E3g1mTF8RsFS/TR6vvgHfiXwcitMNV1cx lidyh4zvIQUM1+9ozn98egkp5nm5yIMMB5kxPwf30cJLN5RrtWnuYnZC8ExrOp9H05X4 uSvJiJegrGP/W8I2BmsVqoALdwf7pgCXgNlZj6WfHYL+S9OnF183YHgl669COcuOZXs0 8Q25ahgAH73O53DCK5vEwcm7HAyaAGGJclL66m4g1ZwZX5lcLS5pvjEBqbMsweNTvLwR YCjrOOXk/rwLq91z6PnSi/IWnmV2RUucrpdgd0Ffir979EcqDrwuHh3QlFMD3cgH9lCR sY6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=q0IjlPdLyA3cEWBQiuNF0SAFheYmblsEgu7HJ3hDm6g=; b=zBCoNzOpyKM102EkepQyLvmrgL372b6aI6B8Dxx9er/bIsbGG76hTOq3En7wHKgyA9 FIrRwULyKdlqvFpIgfASgAk/xh5wckf5M/ss8ipLQSM2h9ZgCgDzlbrG58oLAHAguSSb TPI7FEmBHL08sPK/+DRj3s7QelWVgbJYJT6QsJOPiknlH5Opd/xcNhoGgs0Hfm8uCOv1 syRdmwmLTQ/WmjRTze1WUky/797DN+tty6imbI+lqUEpMn13kqhyDv453rIHYGNP6nkG LgCTC6m57ASgGaDj1gfXU5wVxvn2j2vgdELoNWAXA0tSC1jyLc1xv+/g30sLgFb5L+d9 Qd7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jppSSe1Y; spf=pass (google.com: domain of tiny.windzz@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=tiny.windzz@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id k14-v6sor13659178pgc.11.2018.11.04.04.50.32 for (Google Transport Security); Sun, 04 Nov 2018 04:50:33 -0800 (PST) Received-SPF: pass (google.com: domain of tiny.windzz@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jppSSe1Y; spf=pass (google.com: domain of tiny.windzz@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=tiny.windzz@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=q0IjlPdLyA3cEWBQiuNF0SAFheYmblsEgu7HJ3hDm6g=; b=jppSSe1Y+L5SNtYSjjHsIgaS+IhW05qRNMmAtO0lhT2+klwMeu6IQoE27YGkwf2zwc Cnvfaafx2pEAe/5Dew6obhBeUZd9g/UJU4fhMK6X5NsygemxpRaCJKCIDzdecZQEXndb 6mKIxWhicYmhaifoOTRwsE/4YeXHRtGMsAF9Li8aTOEdZ72tVSsuvBVORgTPbzTeghn3 xFJZGDKITFl/MCu/bdd22uXUWTntbbK+wLROxs6kb+qTUvIufRRypbA0mC3yRCHkGcYj w6vBb9gat6plysHBtC8hp7EztGOqGStOpF9tqlrMFLf2TY18C676k3gGTvg1RxLgam/P x0lg== X-Google-Smtp-Source: AJdET5fCR0CW3qtZehYHZIu0SkoS3fw8GgBE1ArGjkrXoorgdzCMncdhiDze7kA68ou18YL9LTKL6w== X-Received: by 2002:a63:dc0c:: with SMTP id s12mr17091932pgg.398.1541335832710; Sun, 04 Nov 2018 04:50:32 -0800 (PST) Received: from localhost (68.168.130.77.16clouds.com. [68.168.130.77]) by smtp.gmail.com with ESMTPSA id r26-v6sm38358173pga.69.2018.11.04.04.50.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Nov 2018 04:50:31 -0800 (PST) From: Yangtao Li To: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] mm, slab: remove unnecessary unlikely() Date: Sun, 4 Nov 2018 07:50:28 -0500 Message-Id: <20181104125028.3572-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.0 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: X-Virus-Scanned: ClamAV using ClamSMTP WARN_ON() already contains an unlikely(), so it's not necessary to use unlikely. Signed-off-by: Yangtao Li Acked-by: Vlastimil Babka Acked-by: David Rientjes --- mm/slab_common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 7eb8dc136c1c..4f54684f5435 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1029,10 +1029,8 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags) index = size_index[size_index_elem(size)]; } else { - if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) { - WARN_ON(1); + if (WARN_ON(size > KMALLOC_MAX_CACHE_SIZE)) return NULL; - } index = fls(size - 1); }