Re: [PATCH 2/2] mm: compaction: Minimise the time IRQs aredisabled while isolating pages for migration

From: Minchan Kim
Date: Mon Feb 28 2011 - 18:25:23 EST

On Tue, Mar 01, 2011 at 12:07:12AM +0100, Andrea Arcangeli wrote:
> On Tue, Mar 01, 2011 at 08:01:31AM +0900, Minchan Kim wrote:
> > I am not sure it's good if we release the lock whenever lru->lock was contended
> > unconditionally? There are many kinds of lru_lock operations(add to lru,
> > del from lru, isolation, reclaim, activation, deactivation and so on).
> This is mostly to mirror cond_resched_lock (which actually uses
> spin_needbreak but it's ok to have it also when preempt is off). I
> doubt it makes a big difference but I tried to mirror
> cond_resched_lock.

But what's the benefit of releasing lock in here when lock contentionn happen where
activate_page for example?
> > Do we really need to release the lock whenever all such operations were contened?
> > I think what we need is just spin_is_contended_irqcontext.
> > Otherwise, please write down the comment for justifying for it.
> What is spin_is_contended_irqcontext?

I thought what we need function is to check lock contention happened in only irq context
for short irq latency.

> > This patch is for reducing for irq latency but do we have to check signal
> > in irq hold time?
> I think it's good idea to check the signal in case the loop is very
> long and this is run in direct compaction context.

I don't oppose the signal check.
I am not sure why we should check by just sign of lru_lock contention.

How about this by coarse-grained?

/* give a chance to irqs before checking need_resched() */
if (!((low_pfn+1) % SWAP_CLUSTER_MAX)) {
if (fatal_signal_pending(current))
unlocked = true;
if (need_resched() || spin_is_contended(&zone->lru_lock)) {
if (!unlocked)
} else if (unlocked)

> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@xxxxxxxxxx For more info on Linux MM,
> see: .
> Fight unfair telecom internet charges in Canada: sign
> Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

Kind regards,
Minchan Kim
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at