Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp414363ybl; Wed, 21 Aug 2019 22:11:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0tJz858Nrkdt0w9fADHwnCKHlZm64ioFQUyAT61By6Dzb335DYxMJuHiWpAGAdpF7mX/d X-Received: by 2002:a17:90a:ad94:: with SMTP id s20mr3619358pjq.42.1566450698083; Wed, 21 Aug 2019 22:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566450698; cv=none; d=google.com; s=arc-20160816; b=OJq5ACGuvBooAAUflI7dwL6MLVEK/ygBrcNHQZfKxDiyyRdMRhUpRxQ+IyYD3j4+Wh fp0co+k7Z67WncEA5BQudA2J5AuEVHcf+BnQIcvbLdKn1lVci3viTff7QzX8x9TbkpCQ q0d36rU1D5pEulg8tNw7ro2YuhODG5oruCn3fLgoCCvCHTPNpTWqTmn9P9Lc8OaBLpjg 5nXqaURRwd3hI5rKqnB/Kt9zfLWG06yQxcO7xfCyUdfbT988yJHoEjju4CLEDtCuQ6v1 M7WfTNxonlkfpEdR6DE0soLZj1eylEQzDu9Nb+zhHJmPR1uUf4VuCdVSx0L5pDkzZJ/h NNXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=oGXJHuoreTnhCe8S0Fhyydteahhnvrlt9d3TgPgpy3o=; b=WLuNYIZRIgbaYTtHULxNCbSNlJQAuLLBY7SyLGX2y+0lDyqrHsm6fRV2J+AwYEymPE 8K/awdsy1juAKvwHDM5zvkYBu8Ik5v600xrefvHtajnO0D4OOFogE3ZffLn45Hs6C+lg A88nsjib8fi4Jl8hV4ERG4piO2tb7+iLOh8c6is/83wOLa1H/XhF2JQLKTE6dtuEwl13 zajoU4MB59W2R8GEsXglJjqVs4RqlscY6vtD9HA+rStJo0AapFFFoR1hUnY2t67xbmky 2bXBEmqiALMrQt+P0A/iqFBZTeRfNmk1ED5WyG19MHctq5xea+Jaron4tog7dbQ+/mVF q/YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JLwdMo+h; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si17263416pff.66.2019.08.21.22.11.22; Wed, 21 Aug 2019 22:11:38 -0700 (PDT) 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=@kernel.org header.s=default header.b=JLwdMo+h; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730490AbfHVBZJ (ORCPT + 99 others); Wed, 21 Aug 2019 21:25:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:57700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727316AbfHVBZJ (ORCPT ); Wed, 21 Aug 2019 21:25:09 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BAEF82070B; Thu, 22 Aug 2019 01:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566437108; bh=fAmchYbKEVyEzsyvePBupZlerJN00M59W8q92U6VFWE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JLwdMo+hkWLZOEkgdKA7JoF8CUwv8bb3SEouBLk6DfZo3p8jwE/B/YUmbd73PqoP+ pY043x+Frcc6EJOugkUGrR78tacGWuftGkakWA8i4+mYeMXkiiuW6eVbkNLH1We1iR zmiIgwJwszIRadhGE56IP6mnlCmzfKY7o3pfKh90= Date: Wed, 21 Aug 2019 18:25:07 -0700 From: Andrew Morton To: Denis Efremov Cc: Akinobu Mita , Jan Kara , Matthew Wilcox , linux-kernel@vger.kernel.org, dm-devel@redhat.com, linux-fsdevel@vger.kernel.org, linux-media@vger.kernel.org, Erdem Tumurov , Vladimir Shelekhov Subject: Re: [PATCH] lib/memweight.c: optimize by inlining bitmap_weight() Message-Id: <20190821182507.b0dea16f57360cf0ac40deb6@linux-foundation.org> In-Reply-To: <20190821074200.2203-1-efremov@ispras.ru> References: <20190821074200.2203-1-efremov@ispras.ru> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Aug 2019 10:42:00 +0300 Denis Efremov wrote: > This patch inlines bitmap_weight() call. It is better to say the patch "open codes" the bitmap_weight() call. > Thus, removing the BUG_ON, Why is that OK to do? I expect all the code size improvements are from doing this? > and 'longs to bits -> bits to longs' conversion by directly calling > hweight_long(). > > ./scripts/bloat-o-meter lib/memweight.o.old lib/memweight.o.new > add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10 (-10) > Function old new delta > memweight 162 152 -10 >