All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Michal Hocko <mhocko@suse.cz>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH v2] mm: limit mmu_gather batching to fix soft lockups on !CONFIG_PREEMPT
Date: Thu, 20 Dec 2012 12:27:46 -0800	[thread overview]
Message-ID: <20121220122746.72d889fd.akpm@linux-foundation.org> (raw)
In-Reply-To: <20121220124710.GA31912@dhcp22.suse.cz>

On Thu, 20 Dec 2012 13:47:10 +0100
Michal Hocko <mhocko@suse.cz> wrote:

> > > + */
> > > +#if defined(CONFIG_PREEMPT_COUNT)
> > > +#define MAX_GATHER_BATCH_COUNT	(UINT_MAX)
> > > +#else
> > > +#define MAX_GATHER_BATCH_COUNT	(((1UL<<(30-PAGE_SHIFT))/MAX_GATHER_BATCH))
> > 
> > Geeze.  I spent waaaaay too long staring at that expression trying to
> > work out "how many pages is in a batch" and gave up.
> > 
> > Realistically, I don't think we need to worry about CONFIG_PREEMPT here
> > - if we just limit the thing to, say, 64k pages per batch then that
> > will be OK for preemptible and non-preemptible kernels. 
> 
> I wanted the fix to be as non-intrusive as possible so I didn't want to
> touch PREEMPT (which is default in many configs) at all. I am OK to a
> single limit of course.

non-intrusive is nice, but best-implementation is nicer.

> > The performance difference between "64k" and "infinite" will be
> > miniscule and unmeasurable.
> > 
> > Also, the batch count should be independent of PAGE_SIZE.  Because
> > PAGE_SIZE can vary by a factor of 16 and you don't want to fix the
> > problem on 4k page size but leave it broken on 64k page size.
> 
> MAX_GATHER_BATCH depends on the page size so I didn't want to differ
> without a good reason.

There's a good reason!  PAGE_SIZE can vary by a factor of 16, and if
this results in the unpreemptible-CPU-effort varying by a factor of 16
then that's bad, and we should change things so the
unpreemptible-CPU-effort is independent of PAGE_SIZE.


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Michal Hocko <mhocko@suse.cz>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH v2] mm: limit mmu_gather batching to fix soft lockups on !CONFIG_PREEMPT
Date: Thu, 20 Dec 2012 12:27:46 -0800	[thread overview]
Message-ID: <20121220122746.72d889fd.akpm@linux-foundation.org> (raw)
In-Reply-To: <20121220124710.GA31912@dhcp22.suse.cz>

On Thu, 20 Dec 2012 13:47:10 +0100
Michal Hocko <mhocko@suse.cz> wrote:

> > > + */
> > > +#if defined(CONFIG_PREEMPT_COUNT)
> > > +#define MAX_GATHER_BATCH_COUNT	(UINT_MAX)
> > > +#else
> > > +#define MAX_GATHER_BATCH_COUNT	(((1UL<<(30-PAGE_SHIFT))/MAX_GATHER_BATCH))
> > 
> > Geeze.  I spent waaaaay too long staring at that expression trying to
> > work out "how many pages is in a batch" and gave up.
> > 
> > Realistically, I don't think we need to worry about CONFIG_PREEMPT here
> > - if we just limit the thing to, say, 64k pages per batch then that
> > will be OK for preemptible and non-preemptible kernels. 
> 
> I wanted the fix to be as non-intrusive as possible so I didn't want to
> touch PREEMPT (which is default in many configs) at all. I am OK to a
> single limit of course.

non-intrusive is nice, but best-implementation is nicer.

> > The performance difference between "64k" and "infinite" will be
> > miniscule and unmeasurable.
> > 
> > Also, the batch count should be independent of PAGE_SIZE.  Because
> > PAGE_SIZE can vary by a factor of 16 and you don't want to fix the
> > problem on 4k page size but leave it broken on 64k page size.
> 
> MAX_GATHER_BATCH depends on the page size so I didn't want to differ
> without a good reason.

There's a good reason!  PAGE_SIZE can vary by a factor of 16, and if
this results in the unpreemptible-CPU-effort varying by a factor of 16
then that's bad, and we should change things so the
unpreemptible-CPU-effort is independent of PAGE_SIZE.



  reply	other threads:[~2012-12-20 20:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18 16:11 [PATCH] mm: cond_resched in tlb_flush_mmu to fix soft lockups on !CONFIG_PREEMPT Michal Hocko
2012-12-18 16:11 ` Michal Hocko
2012-12-18 18:01 ` Rik van Riel
2012-12-18 18:01   ` Rik van Riel
2012-12-18 22:02 ` Andrew Morton
2012-12-18 22:02   ` Andrew Morton
2012-12-18 23:50   ` Michal Hocko
2012-12-18 23:50     ` Michal Hocko
2012-12-19  0:00     ` Andrew Morton
2012-12-19  0:00       ` Andrew Morton
2012-12-19 15:04       ` [PATCH v2] mm: limit mmu_gather batching " Michal Hocko
2012-12-19 15:04         ` Michal Hocko
2012-12-19 21:13         ` Andrew Morton
2012-12-19 21:13           ` Andrew Morton
2012-12-20 10:24           ` Mel Gorman
2012-12-20 10:24             ` Mel Gorman
2012-12-20 12:47           ` Michal Hocko
2012-12-20 12:47             ` Michal Hocko
2012-12-20 20:27             ` Andrew Morton [this message]
2012-12-20 20:27               ` Andrew Morton
2012-12-20 22:36               ` [PATCH v3] " Michal Hocko
2012-12-20 22:36                 ` Michal Hocko
2012-12-21  8:09                 ` Michal Hocko
2012-12-21  8:09                   ` Michal Hocko
2013-04-27  7:50 ` [PATCH] mm: cond_resched in tlb_flush_mmu " Simon Jeons
2013-04-27  7:50   ` Simon Jeons

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=20121220122746.72d889fd.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=riel@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.