Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1588312imd; Sun, 4 Nov 2018 05:54:54 -0800 (PST) X-Google-Smtp-Source: AJdET5ej8q9bdcOFuGjhfsutkaEzZIgKkLbmxr6zVlfJ4jjeIZDuGyVhfCAMO73TreKalwOuR4Ap X-Received: by 2002:a63:f111:: with SMTP id f17mr17030609pgi.236.1541339694132; Sun, 04 Nov 2018 05:54:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541339694; cv=none; d=google.com; s=arc-20160816; b=D6sVwb1qxrEsB4eVQVgXe/7qiuevLnNtVKAeRSSKsqkJxvNNXgFTI8LU1QFwzeuN0u e8vCAK4g4HoGLGxsJ68tkMnGvQaFiED2XHMdTViI+fonRPRk/27PUngSocqAK4c6twqa BopCJnzvSoIzvl/2kMjAe3wMjucqr7c0q1NngPpD7bkMSZyU31H890N2AAbtU1D9z409 zVXgBKZB450+e5Cdz4MfAjDQ2D7zOyZtACqRk+8jitMzHaZk7SxEiNm7UNiyqyHJxIbv 2Ecfbojxjr6pQtZQ/NWmEaz/QFmkqM3aB0Hy2bLLNQmc4y9s0+Xeqkd2LXN8HrkasRk5 GTUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=q0IjlPdLyA3cEWBQiuNF0SAFheYmblsEgu7HJ3hDm6g=; b=YQz/Z5ZVgoI/f6ynp4IyUJRg/EvSjbZJttxR4m23S26izkvVy+dQhVfpPvEt838uaB 0gRueA7u3d5Do7EFbCQLLr1yPKRYK4z2uyTPTCG+rdWWUprzH1PMMM1jekUHT6maDRXy DJVj9hJW7k+l9zi0BtRLUtJcul4TXBpog8YB4OXWNIoOnrS7h6EQkKrhoS0UpEPNXF0Y kDbVqmO/fb2vslA1G+ndxQDon5tH/gZLgwV+8xtv1cnfnl0D0FejvGKVuFGPk0+Y33I3 P+utfeEHh6cuJdqdWIPKaU5TGLeNj4V7qSeXPSi8T5UQ6SAGNSQ+wyNjqdTAi8ovMKJN Wfqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jppSSe1Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y68-v6si10349071pfi.61.2018.11.04.05.54.39; Sun, 04 Nov 2018 05:54:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jppSSe1Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729434AbeKDWF1 (ORCPT + 99 others); Sun, 4 Nov 2018 17:05:27 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46365 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729388AbeKDWF0 (ORCPT ); Sun, 4 Nov 2018 17:05:26 -0500 Received: by mail-pf1-f194.google.com with SMTP id r64-v6so3083023pfb.13 for ; Sun, 04 Nov 2018 04:50:33 -0800 (PST) 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-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=q0IjlPdLyA3cEWBQiuNF0SAFheYmblsEgu7HJ3hDm6g=; b=KN4Wc1/6PMuTaOVmVh3WVr+yNgxhZiOKPLTVTA+tueDmRVNwI/i6I7bgtG8jj4uJqI SZ9cODkS8ElFKXABWsdQRynm4ikgtiy0/CXzt+qy6H0JF/O+1ARX6JvE56jXixaonuEV //CtvLVib3oGbaKkjBOyC6HwOOooyZM4Vuz4PO4yiDaoJpzK+GSy/EJvz5aBiWJMnMlT 5BIoAO/mBh0lFZwockL31h1ze/wKqtR5vJk9691ovSDy6ejC5WRmFQfT93mqAGWY4iYC nZ0E/iN10nW8ZdufJ/cGnb011brll7RypzZ7KOo/Z+57jZGTZfV+V3BG4anzIU37I7tj ejwQ== X-Gm-Message-State: AGRZ1gJO+7pSg+mdvMy7py9oq+U2CZV8/yeUo0ebj0WOlEAiA1tUcMti giWK4CTlD+Vx6Xu4/peZKRM= 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org WARN_ON() already contains an unlikely(), so it's not necessary to use unlikely. Signed-off-by: Yangtao Li --- 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); } -- 2.17.0