From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Rientjes Subject: Re: [PATCH] tree wide: Use kvfree() than conditional kfree()/vfree() Date: Wed, 18 Nov 2015 16:23:37 -0800 (PST) Message-ID: References: <1447070170-8512-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-path: In-Reply-To: <1447070170-8512-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> Sender: owner-linux-mm@kvack.org To: Tetsuo Handa Cc: akpm@linux-foundation.org, linux-mm@kvack.org, Russell King , linux-acpi@vger.kernel.org, drbd-user@lists.linbit.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Oleg Drokin , Andreas Dilger , codalist@coda.cs.cmu.edu, linux-mtd@lists.infradead.org, Jan Kara , linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org List-Id: linux-acpi@vger.kernel.org On Mon, 9 Nov 2015, Tetsuo Handa wrote: > There are many locations that do > > if (memory_was_allocated_by_vmalloc) > vfree(ptr); > else > kfree(ptr); > > but kvfree() can handle both kmalloc()ed memory and vmalloc()ed memory > using is_vmalloc_addr(). Unless callers have special reasons, we can > replace this branch with kvfree(). Please check and reply if you found > problems. > > Signed-off-by: Tetsuo Handa > Acked-by: Michal Hocko > Cc: Russell King # arm > Cc: # apei > Cc: # drbd > Cc: # mspec > Cc: # drm > Cc: Oleg Drokin # lustre > Cc: Andreas Dilger # lustre > Cc: # coda > Cc: # jffs2 > Cc: Jan Kara # udf > Cc: # xattr > Cc: # ipc + mm > Cc: # ipv4 Acked-by: David Rientjes -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933344AbbKSAXl (ORCPT ); Wed, 18 Nov 2015 19:23:41 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34792 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755806AbbKSAXj (ORCPT ); Wed, 18 Nov 2015 19:23:39 -0500 Date: Wed, 18 Nov 2015 16:23:37 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Tetsuo Handa cc: akpm@linux-foundation.org, linux-mm@kvack.org, Russell King , linux-acpi@vger.kernel.org, drbd-user@lists.linbit.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Oleg Drokin , Andreas Dilger , codalist@TELEMANN.coda.cs.cmu.edu, linux-mtd@lists.infradead.org, Jan Kara , linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] tree wide: Use kvfree() than conditional kfree()/vfree() In-Reply-To: <1447070170-8512-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> Message-ID: References: <1447070170-8512-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 9 Nov 2015, Tetsuo Handa wrote: > There are many locations that do > > if (memory_was_allocated_by_vmalloc) > vfree(ptr); > else > kfree(ptr); > > but kvfree() can handle both kmalloc()ed memory and vmalloc()ed memory > using is_vmalloc_addr(). Unless callers have special reasons, we can > replace this branch with kvfree(). Please check and reply if you found > problems. > > Signed-off-by: Tetsuo Handa > Acked-by: Michal Hocko > Cc: Russell King # arm > Cc: # apei > Cc: # drbd > Cc: # mspec > Cc: # drm > Cc: Oleg Drokin # lustre > Cc: Andreas Dilger # lustre > Cc: # coda > Cc: # jffs2 > Cc: Jan Kara # udf > Cc: # xattr > Cc: # ipc + mm > Cc: # ipv4 Acked-by: David Rientjes From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZzD1C-0008OL-6T for linux-mtd@lists.infradead.org; Thu, 19 Nov 2015 00:24:09 +0000 Received: by pacdm15 with SMTP id dm15so60868607pac.3 for ; Wed, 18 Nov 2015 16:23:39 -0800 (PST) Date: Wed, 18 Nov 2015 16:23:37 -0800 (PST) From: David Rientjes To: Tetsuo Handa cc: akpm@linux-foundation.org, linux-mm@kvack.org, Russell King , linux-acpi@vger.kernel.org, drbd-user@lists.linbit.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Oleg Drokin , Andreas Dilger , codalist@coda.cs.cmu.edu, linux-mtd@lists.infradead.org, Jan Kara , linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] tree wide: Use kvfree() than conditional kfree()/vfree() In-Reply-To: <1447070170-8512-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> Message-ID: References: <1447070170-8512-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Mon, 9 Nov 2015, Tetsuo Handa wrote: > There are many locations that do > > if (memory_was_allocated_by_vmalloc) > vfree(ptr); > else > kfree(ptr); > > but kvfree() can handle both kmalloc()ed memory and vmalloc()ed memory > using is_vmalloc_addr(). Unless callers have special reasons, we can > replace this branch with kvfree(). Please check and reply if you found > problems. > > Signed-off-by: Tetsuo Handa > Acked-by: Michal Hocko > Cc: Russell King # arm > Cc: # apei > Cc: # drbd > Cc: # mspec > Cc: # drm > Cc: Oleg Drokin # lustre > Cc: Andreas Dilger # lustre > Cc: # coda > Cc: # jffs2 > Cc: Jan Kara # udf > Cc: # xattr > Cc: # ipc + mm > Cc: # ipv4 Acked-by: David Rientjes