From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,T_DKIM_INVALID, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A26B2C6778A for ; Sun, 22 Jul 2018 22:19:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BD4C20850 for ; Sun, 22 Jul 2018 22:19:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=thunk.org header.i=@thunk.org header.b="wDgCOCCs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BD4C20850 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mit.edu Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730799AbeGVXR2 (ORCPT ); Sun, 22 Jul 2018 19:17:28 -0400 Received: from imap.thunk.org ([74.207.234.97]:43706 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730347AbeGVXR2 (ORCPT ); Sun, 22 Jul 2018 19:17:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=XjBe8AABJekNVJlDsTX8EGSvDyw5CmuOfIdcMrH502c=; b=wDgCOCCs4wBYRKn+7FtSraO9fY 0JVSWkTzMKwPHJeVmG9g6g8Ejnqwg8V+JaZp58FrtT6Knd9atdvBNKhQ8fp4rtX0VEqv8ywKrO4E+ I3Ez00G27BuMYRyPAKeuseEM7bjpHDAvcsRz+rb7IOYRERbopff3JW3aIJNlvwTW6ygc=; Received: from root (helo=callcc.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.89) (envelope-from ) id 1fhMh8-0005Wj-V6; Sun, 22 Jul 2018 22:19:15 +0000 Received: by callcc.thunk.org (Postfix, from userid 15806) id 7C87A7A6463; Sun, 22 Jul 2018 18:19:11 -0400 (EDT) Date: Sun, 22 Jul 2018 18:19:11 -0400 From: "Theodore Y. Ts'o" To: "Gustavo A. R. Silva" Cc: Andreas Dilger , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ext4: use swap macro in mext_page_double_lock Message-ID: <20180722221911.GC3358@thunk.org> Mail-Followup-To: "Theodore Y. Ts'o" , "Gustavo A. R. Silva" , Andreas Dilger , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180709131600.GA9138@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180709131600.GA9138@embeddedor.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 09, 2018 at 08:16:00AM -0500, Gustavo A. R. Silva wrote: > Make use of the swap macro and remove unnecessary variable *tmp*. > This makes the code easier to read and maintain. Also, reduces the > stack usage. > > This code was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva It doesn't actually reduce stack usage. Look at the definition of swap() in include/linux/kernel.h: #define swap(a, b) \ do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) It removes the variable "tmp", and replace it with "__tmp". It slightly reduces the number of lines of code, so it slightly makes the code easier to maintainer. But I think you are really over-promising how much this commit helps. Regards, - Ted