From patchwork Sat Dec 29 06:25:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Wang X-Patchwork-Id: 10744751 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 856EE13BF for ; Sat, 29 Dec 2018 06:26:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C398289C9 for ; Sat, 29 Dec 2018 06:26:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D081289E9; Sat, 29 Dec 2018 06:26:25 +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=-2.9 required=2.0 tests=BAYES_00,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 1F5BF289C9 for ; Sat, 29 Dec 2018 06:26:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC93B8E0058; Sat, 29 Dec 2018 01:26:22 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B785C8E0001; Sat, 29 Dec 2018 01:26:22 -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 A8FBE8E0058; Sat, 29 Dec 2018 01:26:22 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 7F3A58E0001 for ; Sat, 29 Dec 2018 01:26:22 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id s70so28954795qks.4 for ; Fri, 28 Dec 2018 22:26:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; bh=fGSzNp0O5VCYOmjgqrB6ucsM+dvznLGufTPiF8b39Bw=; b=SCivxSpL4HYn4SXbJh9hNWuICiTO2+WdjIRfEtm/pdPhEH93H8qImee6hC0qaIdu7s 0przlWpR3UX2p533JwND9xNSMuYI7EP3XcF+n+E1P1Xia7yob3D6Vkubg74yBSKaJnFc bvvA8/+5Zj6ZqzNnSpyC5JlA7pU7Ev7hkqwDxkW9/OPDT+jK08iPO3lVplVunpjrLOlI HolpB98Oxr+F96IgTRFS06Y4HMEknr8I/0hqlkBNcL2b3iLTo26/TVRV/kA7aEFT6w3K h/eB8xc1CvHSc0g6cOSQAmarAG329Jsi3m6bziB6o0QKuTXNn3BdFJQEPDs0SBlXWHAf eB1w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of rocking@whu.edu.cn designates 162.243.164.74 as permitted sender) smtp.mailfrom=rocking@whu.edu.cn X-Gm-Message-State: AJcUukcLmjnGSWXfnW2+nRnUkZhdHh+gtBFDc4HCB/K4y9mmTmO4yice FNj2C0R/Z8g8TkEL0XjhGb5jobyPi3QTD8Q+Shtn6/OH5fOvmStB1L87qyBDIjp61SoMPZ2bGyh hzsioj1k1PkoH2Ts1qJ7o1YLUglT6B9zWBhLrjyCb8TGY84F3RrAJzSVZfDZBW6Ow3w== X-Received: by 2002:a0c:e5c1:: with SMTP id u1mr29037201qvm.113.1546064782282; Fri, 28 Dec 2018 22:26:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN72tBvOhapAMUix8jBYbBSoBd/6PfxqPwa2IE/ujr9jcDYxbM1jb6GJryeEzCpwzVTGRv9K X-Received: by 2002:a0c:e5c1:: with SMTP id u1mr29037181qvm.113.1546064781468; Fri, 28 Dec 2018 22:26:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546064781; cv=none; d=google.com; s=arc-20160816; b=B0ubE+hlx57BvjivSySqcLz3m+UQ4NjJC1gjFVXCrKDZhYsbeqK7MQD8Cq+LXjYhb0 qNqeJnnZ8AR91L2Pf8H/RgmLvod0ijIsnrORcq3e1QygT50ut7xLXjBUgDsnwhGsM2rg qzpr57RsIdh0KoL3OO0a3xzLjIlpOv9Sql8j05KR4uk6h1nm2gzIdPzAwHJnLeahTc6R d2JITNssBQLDz2AKGlnXXwHVJE9Lh/5LVv17sNVixPt32RoQ0St7FVIVtJekANKzju1F 8f64LpsiKkyAlDOAgunGg6+DFPUKUuNkUtkT0TwGzxITOgml05VXo67g2wDhiIv2WKri s42A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=fGSzNp0O5VCYOmjgqrB6ucsM+dvznLGufTPiF8b39Bw=; b=HmB27ZC8mkRha9VvWq62IYWBMAZSwgK9zZ/+LZz1UONNjk0fypBRFXBDPzcHJJNv+x cnbfjEamqlIUPd5y95fWTZYQIhTD/HiS5N6SA/kRSlAgEhTBF90Sq1nGqr9n5QwI3xt2 2uQOLi9r9zE708Db21monVwndE12MxJmNt3IcKxWEvZ5f6bM00L/mdSNkk8Yu8631xGC fxD6F6IxBqVJ86C/HHwfW1X+C1QviLeErPYR1T1/+88tAxTPwRA6QmrD8eCezIGet2mq WpRkLNnYDl/2cFuDrYnLhSuDhP9rQx0bRywCSx5Rz66f758qLlaaDFAfL0jrR1Y0WXLu tV2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of rocking@whu.edu.cn designates 162.243.164.74 as permitted sender) smtp.mailfrom=rocking@whu.edu.cn Received: from zg8tmtyylji0my4xnjqunzqa.icoremail.net (zg8tmtyylji0my4xnjqunzqa.icoremail.net. [162.243.164.74]) by mx.google.com with SMTP id r1si5327991qkd.250.2018.12.28.22.26.20 for ; Fri, 28 Dec 2018 22:26:20 -0800 (PST) Received-SPF: pass (google.com: domain of rocking@whu.edu.cn designates 162.243.164.74 as permitted sender) client-ip=162.243.164.74; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rocking@whu.edu.cn designates 162.243.164.74 as permitted sender) smtp.mailfrom=rocking@whu.edu.cn Received: from localhost (unknown [114.255.3.133]) by email1 (Coremail) with SMTP id AQBjCgBnb_t0Eydcn5WbCQ--.51776S2; Sat, 29 Dec 2018 14:26:11 +0800 (CST) From: Peng Wang 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, Peng Wang Subject: [PATCH] mm/slub.c: freelist is ensured to be NULL when new_slab() fails Date: Sat, 29 Dec 2018 14:25:12 +0800 Message-Id: <20181229062512.30469-1-rocking@whu.edu.cn> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CM-TRANSID: AQBjCgBnb_t0Eydcn5WbCQ--.51776S2 X-Coremail-Antispam: 1UD129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUYo7AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E 6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28Cjx kF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8I cVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87 Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE 6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72 CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7 MxkIecxEwVAFwVW8AwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s 026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_ Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20x vEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2 jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0x ZFpf9x0JU-J5rUUUUU= X-CM-SenderInfo: qsqrijaqrviiqqxyq4lkxovvfxof0/ 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 new_slab_objects() will return immediately if freelist is not NULL. if (freelist) return freelist; One more assignment operation could be avoided. Signed-off-by: Peng Wang Reviewed-by: Pekka Enberg Acked-by: David Rientjes --- mm/slub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 36c0befeebd8..cf2ef4ababff 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2463,8 +2463,7 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags, stat(s, ALLOC_SLAB); c->page = page; *pc = c; - } else - freelist = NULL; + } return freelist; }