linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: wangjianxing <wangjianxing@loongson.cn>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] mm/page_alloc: add scheduling point to free_unref_page_list
Date: Wed, 9 Mar 2022 17:05:17 -0800	[thread overview]
Message-ID: <20220309170517.05facf4a2d183cc9aac9196d@linux-foundation.org> (raw)
In-Reply-To: <YieCFVMJOgT7es6E@casper.infradead.org>

On Tue, 8 Mar 2022 16:19:33 +0000 Matthew Wilcox <willy@infradead.org> wrote:

> On Tue, Mar 01, 2022 at 08:38:25PM -0500, wangjianxing wrote:
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 3589febc6..1b96421c8 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -3479,6 +3479,9 @@ void free_unref_page_list(struct list_head *list)
> >  		 */
> >  		if (++batch_count == SWAP_CLUSTER_MAX) {
> >  			local_unlock_irqrestore(&pagesets.lock, flags);
> > +
> > +			cond_resched();
> 
> This isn't safe.  This path can be called from interrupt context
> (otherwise we'd be using local_unlock_irq() instead of irqrestore()).

What a shame it is that we don't document our interfaces :(

I can't immediately find such callers, but I could imagine
put_pages_list() (which didn't document its interface this way either)
being called from IRQ.

And drivers/iommu/dma-iommu.c:fq_ring_free() calls put_pages_list()
from inside spin_lock().  


  reply	other threads:[~2022-03-10  1:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02  1:38 wangjianxing
2022-03-02 23:34 ` Andrew Morton
2022-03-03  2:02   ` wangjianxing
2022-03-08 16:04   ` Vlastimil Babka
2022-03-08 16:05 ` Vlastimil Babka
2022-03-08 16:19 ` Matthew Wilcox
2022-03-10  1:05   ` Andrew Morton [this message]
2022-03-10  2:48     ` wangjianxing
2022-03-10  3:29       ` Andrew Morton
2022-03-10  9:11         ` Vlastimil Babka
2022-03-11  3:22           ` wangjianxing

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=20220309170517.05facf4a2d183cc9aac9196d@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wangjianxing@loongson.cn \
    --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