mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: mason@suse.com
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Unnecessary barrier in sync_page()?
Date: Wed, 7 Jul 2004 14:57:24 -0300	[thread overview]
Message-ID: <20040707175724.GB3106@logos.cnet> (raw)


Hi Chris,

I was talking to Andrew about this memory barrier 

static inline int sync_page(struct page *page)
{
        struct address_space *mapping;
                                                                                        
        /*
         * FIXME, fercrissake.  What is this barrier here for?
         */
        smp_mb();
        mapping = page_mapping(page);
        if (mapping && mapping->a_ops && mapping->a_ops->sync_page)
                return mapping->a_ops->sync_page(page);
        return 0;
}

And does not seem to be a reason for it. The callers are:

void fastcall wait_on_page_bit(struct page *page, int bit_nr)
{
        wait_queue_head_t *waitqueue = page_waitqueue(page);
        DEFINE_PAGE_WAIT(wait, page, bit_nr);
                                                                                        
        do {
                prepare_to_wait(waitqueue, &wait.wait, TASK_UNINTERRUPTIBLE);
                if (test_bit(bit_nr, &page->flags)) {
                        sync_page(page);
                        io_schedule();
                }
        } while (test_bit(bit_nr, &page->flags));
        finish_wait(waitqueue, &wait.wait);
} 

void fastcall __lock_page(struct page *page)
{
        wait_queue_head_t *wqh = page_waitqueue(page);
        DEFINE_PAGE_WAIT_EXCLUSIVE(wait, page, PG_locked);
                                                                                        
        while (TestSetPageLocked(page)) {
                prepare_to_wait_exclusive(wqh, &wait.wait, TASK_UNINTERRUPTIBLE);
                if (PageLocked(page)) {
                        sync_page(page);
                        io_schedule();
                }
        }
        finish_wait(wqh, &wait.wait);
}

Both callers call set_bit (atomic operation which cannot be reordered) before 
sync_page(), so.. what is the barrier trying to guarantee? 

TIA


             reply	other threads:[~2004-07-07 17:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-07 17:57 Marcelo Tosatti [this message]
2004-07-07 18:20 ` Andrea Arcangeli
2004-07-07 18:29   ` Andrew Morton
2004-07-07 18:42     ` Andrea Arcangeli
2004-07-07 18:46       ` Andrea Arcangeli
2004-07-07 20:57       ` Chris Mason
2004-07-07 21:06         ` Andrea Arcangeli
2004-07-07 21:15           ` Chris Mason
2004-07-07 21:30           ` Andrew Morton
2004-07-07 21:34             ` Chris Mason
2004-07-07 22:02             ` Andrea Arcangeli
2004-07-07 22:27               ` Andrew Morton
2004-07-07 18:58   ` Marcelo Tosatti
2004-07-07 19:12     ` Andrea Arcangeli

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=20040707175724.GB3106@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®