Linux-mm Archive on lore.kernel.org
 help / color / Atom feed
* Re: [PATCH] mm/dmapool.c: add WARN_ON() in dma_pool_destroy
  2020-07-31  2:39 [PATCH] mm/dmapool.c: add WARN_ON() in dma_pool_destroy qiang.zhang
@ 2020-07-31  2:38 ` Matthew Wilcox
  2020-07-31 20:32   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2020-07-31  2:38 UTC (permalink / raw)
  To: qiang.zhang; +Cc: akpm, linux-mm, linux-kernel

On Fri, Jul 31, 2020 at 10:39:39AM +0800, qiang.zhang@windriver.com wrote:
> The pool is being destroyed, all page which in the pool,
> should be free. if some page is still be use by somebody,
> we should not just output error logs, also should also add
> a warning message.

There's already a warning message.  What value does this actually have?

> Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>
> ---
>  mm/dmapool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/dmapool.c b/mm/dmapool.c
> index f9fb9bbd733e..8f4dc53dde5b 100644
> --- a/mm/dmapool.c
> +++ b/mm/dmapool.c
> @@ -285,7 +285,7 @@ void dma_pool_destroy(struct dma_pool *pool)
>  		struct dma_page *page;
>  		page = list_entry(pool->page_list.next,
>  				  struct dma_page, page_list);
> -		if (is_page_busy(page)) {
> +		if (WARN_ON(is_page_busy(page))) {
>  			if (pool->dev)
>  				dev_err(pool->dev,
>  					"dma_pool_destroy %s, %p busy\n",
> -- 
> 2.26.2
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] mm/dmapool.c: add WARN_ON() in dma_pool_destroy
@ 2020-07-31  2:39 qiang.zhang
  2020-07-31  2:38 ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: qiang.zhang @ 2020-07-31  2:39 UTC (permalink / raw)
  To: willy, akpm; +Cc: linux-mm, linux-kernel

From: Zhang Qiang <qiang.zhang@windriver.com>

The pool is being destroyed, all page which in the pool,
should be free. if some page is still be use by somebody,
we should not just output error logs, also should also add
a warning message.

Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>
---
 mm/dmapool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/dmapool.c b/mm/dmapool.c
index f9fb9bbd733e..8f4dc53dde5b 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -285,7 +285,7 @@ void dma_pool_destroy(struct dma_pool *pool)
 		struct dma_page *page;
 		page = list_entry(pool->page_list.next,
 				  struct dma_page, page_list);
-		if (is_page_busy(page)) {
+		if (WARN_ON(is_page_busy(page))) {
 			if (pool->dev)
 				dev_err(pool->dev,
 					"dma_pool_destroy %s, %p busy\n",
-- 
2.26.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/dmapool.c: add WARN_ON() in dma_pool_destroy
  2020-07-31  2:38 ` Matthew Wilcox
@ 2020-07-31 20:32   ` Andrew Morton
  2020-07-31 20:49     ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2020-07-31 20:32 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: qiang.zhang, linux-mm, linux-kernel

On Fri, 31 Jul 2020 03:38:58 +0100 Matthew Wilcox <willy@infradead.org> wrote:

> On Fri, Jul 31, 2020 at 10:39:39AM +0800, qiang.zhang@windriver.com wrote:
> > The pool is being destroyed, all page which in the pool,
> > should be free. if some page is still be use by somebody,
> > we should not just output error logs, also should also add
> > a warning message.
> 
> There's already a warning message.  What value does this actually have?

Presumably so we get a backtrace in order to identify the errant
caller.  

I added a bit to the changelog:

: The pool is being destroyed so all pages which are in the pool should be
: free.  If some page is still in use by somebody, we should not just output
: error logs, also should also add a WARN message so the stack backtrace may
: be used to identify the caller.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/dmapool.c: add WARN_ON() in dma_pool_destroy
  2020-07-31 20:32   ` Andrew Morton
@ 2020-07-31 20:49     ` Matthew Wilcox
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2020-07-31 20:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: qiang.zhang, linux-mm, linux-kernel

On Fri, Jul 31, 2020 at 01:32:15PM -0700, Andrew Morton wrote:
> On Fri, 31 Jul 2020 03:38:58 +0100 Matthew Wilcox <willy@infradead.org> wrote:
> 
> > On Fri, Jul 31, 2020 at 10:39:39AM +0800, qiang.zhang@windriver.com wrote:
> > > The pool is being destroyed, all page which in the pool,
> > > should be free. if some page is still be use by somebody,
> > > we should not just output error logs, also should also add
> > > a warning message.
> > 
> > There's already a warning message.  What value does this actually have?
> 
> Presumably so we get a backtrace in order to identify the errant
> caller.  

The existing message includes the name of the pool.  We don't typically
have more than one place that destroys a pool.

What might be helpful would be something that said who allocated and
didn't free the object, but again, there's typically only one place which
allocates from any given pool, so even that would be all that helpful.

I'm not particularly impressed by these patches which don't actually
justify themselves.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31  2:39 [PATCH] mm/dmapool.c: add WARN_ON() in dma_pool_destroy qiang.zhang
2020-07-31  2:38 ` Matthew Wilcox
2020-07-31 20:32   ` Andrew Morton
2020-07-31 20:49     ` Matthew Wilcox

Linux-mm Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
		linux-mm@kvack.org
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kvack.linux-mm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git