All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <Matthew.Wilcox@genedata.com>
To: Jeffrey A Law <law@cygnus.com>
Cc: Matthew Wilcox <Matthew.Wilcox@genedata.com>,
	Grant Grundler <grundler@cup.hp.com>,
	parisc-linux@thepuffingroup.com
Subject: Re: [parisc-linux] Anyone got a few moments?
Date: Mon, 28 Jun 1999 20:10:16 +0200	[thread overview]
Message-ID: <19990628201016.J30362@mencheca.ch.genedata.com> (raw)
In-Reply-To: <17559.930592076@upchuck.cygnus.com>; from Jeffrey A Law on Mon, Jun 28, 1999 at 11:47:56AM -0600

On Mon, Jun 28, 1999 at 11:47:56AM -0600, Jeffrey A Law wrote:
> Yes.  Major pain since the only useful atomic operations are load & clear
> word/double as you noted.

That does seem to be the majority of uses (based on a grep).  But not all
are, unfortunately:

./drivers/net/slip.c:   rbuff = xchg(&sl->rbuff, rbuff);
./drivers/net/slip.c:   xbuff = xchg(&sl->xbuff, xbuff);
./drivers/net/slip.c:   cbuff = xchg(&sl->cbuff, cbuff);
./drivers/net/slip.c:   slcomp = xchg(&sl->slcomp, slcomp);
./drivers/net/slip.c:   xbuff    = xchg(&sl->xbuff, xbuff);
./drivers/net/slip.c:   rbuff    = xchg(&sl->rbuff, rbuff);
./drivers/net/slip.c:   cbuff    = xchg(&sl->cbuff, cbuff);
./drivers/scsi/scsi_queue.c:    cpnt = xchg(&host->pending_commands, cmd);
./drivers/scsi/scsi_queue.c:    cmd = xchg(&host->pending_commands, cpnt);
./fs/smbfs/sock.c:      data_ready = xchg(&sk->data_ready, smb_data_callback);
./fs/smbfs/sock.c:      data_ready = xchg(&sk->data_ready, server->data_ready);
./kernel/sys.c: mask = xchg(&current->fs->umask, mask & S_IRWXUGO);
./mm/slab.c:    if (xchg((unsigned long *)objp, SLAB_RED_MAGIC2) != SLAB_RED_MAG
IC1)
./mm/slab.c:    if (xchg((unsigned long *)(objp+cachep->c_org_size), SLAB_RED_MA
GIC2) != SLAB_RED_MAGIC1)
./mm/slab.c:    if (xchg((unsigned long *)objp, SLAB_RED_MAGIC1) != SLAB_RED_MAG
IC2) {
./mm/slab.c:    if (xchg((unsigned long *)(objp+cachep->c_org_size+BYTES_PER_WOR
D), SLAB_RED_MAGIC1) != SLAB_RED_MAGIC2) {
./net/core/utils.c:     toks += now - xchg(&last_msg, now);
./net/ipv4/ip_forward.c:                        dst_release(xchg(&skb->dev->fast
path[h], dst_clone(&rt->u.dst)));
./net/ipv4/ip_sockglue.c:                       opt = xchg(&sk->opt, opt);
./net/ipv4/tcp_ipv4.c:  dst_release(xchg(&sk->dst_cache, rt));
./net/ipv4/tcp_ipv4.c:          dst_release(xchg(&sk->dst_cache, &rt->u.dst));
./net/ipv6/ipv6_sockglue.c:             opt = xchg(&np->opt, opt);
./net/ipv6/tcp_ipv6.c:                          skb = xchg(&sk->net_pinfo.af_ine
t6.pktoptions, skb2);
./net/sched/cls_rsvp.h:                 tcf_police_release(xchg(&f->police, poli
ce));
./net/sched/cls_u32.c:          ht_down = xchg(&n->ht_down, ht_down);
./net/sched/cls_u32.c:          tcf_police_release(xchg(&n->police, police));
./net/sched/sch_cbq.c:          if ((*old = xchg(&cl->q, new)) != NULL)
./net/sched/sch_cbq.c:                  rtab = xchg(&cl->R_tab, rtab);
./net/sched/sch_generic.c:      qdisc = xchg(&dev->qdisc, &noop_qdisc);
./net/sched/sch_prio.c: *old = xchg(&q->queues[band], new);
./net/sched/sch_teql.c:         teql_neigh_release(xchg(&q->ncache, n));


and that's it.  That's only 31 uses where xchg couldn't be replaced
with get_and_zero.  I suspect most of these are using this mechanism to
walk a list without using a spinlock.  The slab uses are debug code only
(so they aren't performance critical by any means).  I bet most of these
uses could be removed without _too_ many problems.  I wonder what Linus'
opinion is on this.

-- 
Matthew Wilcox <willy@bofh.ai>
"Windows and MacOS are products, contrived by engineers in the service of
specific companies. Unix, by contrast, is not so much a product as it is a
painstakingly compiled oral history of the hacker subculture." - N Stephenson

  reply	other threads:[~1999-06-28 18:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-28 15:21 [parisc-linux] Anyone got a few moments? Matthew Wilcox
1999-06-28 17:09 ` Grant Grundler
1999-06-28 17:34   ` Matthew Wilcox
1999-06-28 17:47     ` Jeffrey A Law
1999-06-28 18:10       ` Matthew Wilcox [this message]
1999-06-28 18:37         ` Alan Cox
1999-06-28 19:00           ` Matthew Wilcox
1999-06-28 19:12             ` Alan Cox
1999-06-28 18:39       ` Alan Cox

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=19990628201016.J30362@mencheca.ch.genedata.com \
    --to=matthew.wilcox@genedata.com \
    --cc=grundler@cup.hp.com \
    --cc=law@cygnus.com \
    --cc=parisc-linux@thepuffingroup.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.