Re: [PATCH v2 2/8] block,fs,mm: IO cgroup tracking for bufferedwrite
From: KAMEZAWA Hiroyuki
Date: Thu Mar 24 2011 - 04:33:52 EST
On Wed, 23 Mar 2011 10:21:01 -0700
Justin TerAvest <teravest@xxxxxxxxxx> wrote:
> On Tue, Mar 22, 2011 at 9:52 PM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> > On Tue, 22 Mar 2011 16:08:49 -0700
> > Justin TerAvest <teravest@xxxxxxxxxx> wrote:
> >
> >> +static inline void page_cgroup_set_blkio_id(struct page_cgroup *pc,
> >> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â unsigned long id)
> >> +{
> >> + Â Â unsigned long old, new, prev;
> >> +
> >> + Â Â /* pc->flags isn't lock protected, so we must cmpxchg. */
> >> + Â Â WARN_ON(id >= (1UL << PAGE_TRACKING_ID_BITS));
> >> + Â Â do {
> >> + Â Â Â Â Â Â new = old = pc->flags;
> >> + Â Â Â Â Â Â new &= (1UL << PAGE_TRACKING_ID_SHIFT) - 1;
> >> + Â Â Â Â Â Â new |= (unsigned long)(id << PAGE_TRACKING_ID_SHIFT);
> >> + Â Â Â Â Â Â prev = cmpxchg(&pc->flags, old, new);
> >> + Â Â } while (prev != old);
> >
> > How to support archs which doesn't have cmpxchg ?
> > At least, you need take care of compile error.
>
> Hi Kame,
>
> Is there really no generic cmpxchg()? I thought that was what
> include/asm-generic/cmpxchg-local.h was for.
>
I'm not sure ;) But I myself tend to avoid to use cmpxchg which
cannot be used in CONFIG_SMP, sometimes.
Thanks,
-Kame
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/