[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151109160726.GB8644@n2100.arm.linux.org.uk>
Date: Mon, 9 Nov 2015 16:07:26 +0000
From: Russell King - ARM Linux <linux@....linux.org.uk>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-acpi@...r.kernel.org, drbd-user@...ts.linbit.com,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
Oleg Drokin <oleg.drokin@...el.com>,
Andreas Dilger <andreas.dilger@...el.com>,
codalist@...a.cs.cmu.edu, linux-mtd@...ts.infradead.org,
Jan Kara <jack@...e.com>, linux-fsdevel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH] tree wide: Use kvfree() than conditional kfree()/vfree()
On Mon, Nov 09, 2015 at 08:56:10PM +0900, 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 <penguin-kernel@...ove.SAKURA.ne.jp>
> Acked-by: Michal Hocko <mhocko@...e.com>
> Cc: Russell King <linux@....linux.org.uk> # arm
Acked-by: Russell King <rmk+kernel@....linux.org.uk>
In so far as this ARM specific change looks reasonable. Thanks.
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index e62400e..492bf3e 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -1200,10 +1200,7 @@ error:
> while (i--)
> if (pages[i])
> __free_pages(pages[i], 0);
> - if (array_size <= PAGE_SIZE)
> - kfree(pages);
> - else
> - vfree(pages);
> + kvfree(pages);
> return NULL;
> }
>
> @@ -1211,7 +1208,6 @@ static int __iommu_free_buffer(struct device *dev, struct page **pages,
> size_t size, struct dma_attrs *attrs)
> {
> int count = size >> PAGE_SHIFT;
> - int array_size = count * sizeof(struct page *);
> int i;
>
> if (dma_get_attr(DMA_ATTR_FORCE_CONTIGUOUS, attrs)) {
> @@ -1222,10 +1218,7 @@ static int __iommu_free_buffer(struct device *dev, struct page **pages,
> __free_pages(pages[i], 0);
> }
>
> - if (array_size <= PAGE_SIZE)
> - kfree(pages);
> - else
> - vfree(pages);
> + kvfree(pages);
> return 0;
> }
>
--
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists