Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6845826imb; Sat, 9 Mar 2019 07:56:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzAdw5S1eTSkZK2VBRPn9frT3qRCCzMPvKFo9Hu6IZiJazObw06NFOqZn/oI31/w8f4QEJp X-Received: by 2002:a65:6383:: with SMTP id h3mr21725714pgv.11.1552146991736; Sat, 09 Mar 2019 07:56:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552146991; cv=none; d=google.com; s=arc-20160816; b=0IcvM4ZOrkwn/NzdDQFe8D25fM4/prqALGvEEaV1kj6YNjSinuzu9DbE+e7X9qW/wg 5PePHkDSEsPZqSuOUp7hVKMt/oIUfzZxaRQVGtMsy6SM5nNqFsX8KrD1O+LLN5kqElQF OG4Nwl5IPFB7SYKt9NzETohyGjS4uga73bMU8gmHvboBVMeUwY8mJ8dgPLQPJMJdsk6W t4Td7mi2p0KwHduyp+9YrhPRRBL85yPUws5MAtZavBs0EqrjcPIOXDiI9+TYO6t0h5JH UtjXHFZFJRFzABn3w7b2tquERN3ZEZMEhFmA+72nnYXBSw28R+O3GLWngrEqpmEf+Qw5 cVaQ== 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=mKX7nHl0E3bMBOEvjq+9ioWsVbmR1gncT6svDrCMxtE=; b=y5V01v0Y3sZIPOsjk3T2EhdOl/tmmrEuTYHCWIMUF88JSMGiUWFC/0gZG5If4iBBeq +uTmLXXDs1PQS/yw5GQzWV50xeflcC0MHWntunG3kL2i71/d9FsWK2YNPC36AuwpxWYL 8St2FQOPdck3kx2SrbyQ0+MMczyUGng5bIFBawn3t6U3XpWebwdtA1YVwjnIFSBfN9pT 3xy7MUd8PMpLiTdOuIKaMBpcDatbHr/CPQq7C+Buph3Bkq1SnCoD1sCHla5mc9Ygvgd1 ewwUjqnA/fhOzg4LEPF9e6IJIN7duzOe/Tvq+47g8bz6D7jo0qxa/OojycSMCV3I4bSX L9Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WceqsJKW; 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 ([209.132.180.67]) by mx.google.com with ESMTP id z21si726260pgi.97.2019.03.09.07.56.16; Sat, 09 Mar 2019 07:56:31 -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=WceqsJKW; 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 S1726352AbfCIPgp (ORCPT + 99 others); Sat, 9 Mar 2019 10:36:45 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46818 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725841AbfCIPgp (ORCPT ); Sat, 9 Mar 2019 10:36:45 -0500 Received: by mail-pf1-f195.google.com with SMTP id g6so340103pfh.13; Sat, 09 Mar 2019 07:36:44 -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=mKX7nHl0E3bMBOEvjq+9ioWsVbmR1gncT6svDrCMxtE=; b=WceqsJKWUuiMUYqcaTNzQO97FxsQq/tB/yyJ62Pe+fS8OlO9qEJ9fZug2x3ZW4UUit m0MiXdzFHsP30Id7IGBr+HIxfwvTp8de6Gd4FtgcQ6LpH1VYUu2DG36xp0PsXd5VhAS5 skaZQdPZ6xeR6/VjJtBJn61rA8ndG8QIAEm4Rf3WBq9yhUWgq9S5Ad73xqQrS+GvH6N/ rmHXV6Dx++TA9IK5nhPp7928zW8V99iqvlx/124lYWNQYJ+qiHCJVHlDNzjBidxxx4qv R5hfkXdSEzso3/Yj+X0mDzT8LBrQpcT8dW+9V49JyXKLTssXvnoMv3bYDWnM9P5RuQf1 94cQ== 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=mKX7nHl0E3bMBOEvjq+9ioWsVbmR1gncT6svDrCMxtE=; b=FM0/k+KjDqmrFoX6Zn3qK/4ejhSgvQgAu+Kq2TWPezSSTuLOXBwT6Dh33Cxo5O9HVK 4QJBdSlFiOfco0z5GxhRuJDnwqCBF1EIugdZZcNrud5eo0ZnPRr1wsPnmgrPjM1NWN1O iT5L9PHT4P5Od6vcPqy6A0ijkwqWqF01H7aklvikwPKmYe9gHTP3hJ5jTYIVFQWiBdBv FXZX5KMRXeR3hbd8esjaOTku3hjKvaKZfCnblwyhz/5uFP2Ldol2hbbppiRxN6lRimpY sjm5Ei+PEoX3xBVYQs7/igqZUXKjOTpZzoWFocG+fGIur0hbBlrze/lkgXAIszfjmTLP cXyA== X-Gm-Message-State: APjAAAWjUriWPGNbj504KW3GRWKAZtBoIEKfFf5IOmJ3CiV/u7O54aYk /htb5FMuQHzQTUpLNIJxx+M= X-Received: by 2002:a63:b242:: with SMTP id t2mr22032518pgo.451.1552145804430; Sat, 09 Mar 2019 07:36:44 -0800 (PST) Received: from localhost (www.xihetech.top. [159.203.232.101]) by smtp.gmail.com with ESMTPSA id r131sm1317822pgr.65.2019.03.09.07.36.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Mar 2019 07:36:44 -0800 (PST) From: Sean Fu To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Fu Subject: [PATCH] xfs: Use kmem_zalloc for bp->b_pages. Date: Sat, 9 Mar 2019 23:36:36 +0800 Message-Id: <20190309153636.14154-1-fxinrong@gmail.com> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change the allocation of bp->b_pages to use kmem_zalloc instead of kmem_alloc. Remove unnecessary memset for bp->b_pages. This reduces text size by 42 bytes. Before: text data bss dec hex filename 23335 588 8 23931 5d7b ./fs/xfs/xfs_buf.o After: text data bss dec hex filename 23293 588 8 23889 5d51 ./fs/xfs/xfs_buf.o Signed-off-by: Sean Fu --- fs/xfs/xfs_buf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 4f5f2ff3f70f..be4f740b97c1 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -289,12 +289,11 @@ _xfs_buf_get_pages( if (page_count <= XB_PAGES) { bp->b_pages = bp->b_page_array; } else { - bp->b_pages = kmem_alloc(sizeof(struct page *) * + bp->b_pages = kmem_zalloc(sizeof(struct page *) * page_count, KM_NOFS); if (bp->b_pages == NULL) return -ENOMEM; } - memset(bp->b_pages, 0, sizeof(struct page *) * page_count); } return 0; } -- 2.16.4