[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1301281747210.4947@eggly.anvils>
Date: Mon, 28 Jan 2013 18:03:16 -0800 (PST)
From: Hugh Dickins <hughd@...gle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: Petr Holasek <pholasek@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Izik Eidus <izik.eidus@...ellosystems.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 6/11] ksm: remove old stable nodes more thoroughly
On Mon, 28 Jan 2013, Andrew Morton wrote:
> On Fri, 25 Jan 2013 18:01:59 -0800 (PST)
> Hugh Dickins <hughd@...gle.com> wrote:
>
> > +static int remove_all_stable_nodes(void)
> > +{
> > + struct stable_node *stable_node;
> > + int nid;
> > + int err = 0;
> > +
> > + for (nid = 0; nid < nr_node_ids; nid++) {
> > + while (root_stable_tree[nid].rb_node) {
> > + stable_node = rb_entry(root_stable_tree[nid].rb_node,
> > + struct stable_node, node);
> > + if (remove_stable_node(stable_node)) {
> > + err = -EBUSY;
>
> It's a bit rude to overwrite remove_stable_node()'s return value.
Well.... yes, but only the tiniest bit rude :)
>
> > + break; /* proceed to next nid */
> > + }
> > + cond_resched();
>
> Why is this here?
Because we don't have a limit on the length of this loop, and if
every node which remove_stable_node() finds is already stale, and
has no rmap_item still attached, then there would be no rescheduling
point in the unbounded loop without this one. I was taught to worry
about bad latencies even in unpreemptible kernels.
Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists