linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Subject: Re: [PATCH v1] mm/dmapool.c: Replace open-coded list_first_entry()
Date: Thu, 13 Aug 2020 14:09:33 +0300	[thread overview]
Message-ID: <20200813110933.GM1891694@smile.fi.intel.com> (raw)
In-Reply-To: <20200812184141.GC17456@casper.infradead.org>

On Wed, Aug 12, 2020 at 07:41:41PM +0100, Matthew Wilcox wrote:
> On Wed, Aug 12, 2020 at 06:30:59PM +0300, Andy Shevchenko wrote:
> >  	while (!list_empty(&pool->page_list)) {
> >  		struct dma_page *page;
> > -		page = list_entry(pool->page_list.next,
> > -				  struct dma_page, page_list);
> > +
> > +		page = list_first_entry(&pool->page_list, struct dma_page, page_list);
> 
> Eh, I'd rather see this as:
> 
> 		struct dma_page *page = list_first_entry(&pool->page_list,
> 				struct dma_page, page_list);

On the second thought we may convert the entire loop to use
list_for_each_entry_safe() since there is no locking in between, we
should be fine.

-- 
With Best Regards,
Andy Shevchenko




      reply	other threads:[~2020-08-13 11:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 15:30 [PATCH v1] mm/dmapool.c: Replace open-coded list_first_entry() Andy Shevchenko
2020-08-12 18:41 ` Matthew Wilcox
2020-08-13 11:09   ` Andy Shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200813110933.GM1891694@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).