All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: linux-mm@kvack.org
Subject: __set_page_dirty_nobuffers superfluous check
Date: Fri, 13 Aug 2004 15:05:04 -0300	[thread overview]
Message-ID: <20040813180504.GB29875@logos.cnet> (raw)

Hi,

While wandering through mm/page-writeback.c I noticed
__set_page_dirty_nobuffers does:

int __set_page_dirty_nobuffers(struct page *page)
{
        int ret = 0;
                                                                                         
        if (!TestSetPageDirty(page)) {
                struct address_space *mapping = page_mapping(page);
                                                                                         
                if (mapping) {
                        spin_lock_irq(&mapping->tree_lock);
                        mapping = page_mapping(page);
                        if (page_mapping(page)) { /* Race with truncate? */
                                BUG_ON(page_mapping(page) != mapping);    <------------------
                                if (!mapping->backing_dev_info->memory_backed)
                                        inc_page_state(nr_dirty);
                                radix_tree_tag_set(&mapping->page_tree,
                                        page_index(page), PAGECACHE_TAG_DIRTY);
                        }

How could the mapping ever change if we have tree_lock?

Its basically a check which assumes there might be 
buggy page->mapping writers who do so without the lock, yes?
--
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:"aart@kvack.org"> aart@kvack.org </a>

             reply	other threads:[~2004-08-13 19:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-13 18:05 Marcelo Tosatti [this message]
2004-08-14  6:46 ` __set_page_dirty_nobuffers superfluous check Hugh Dickins
2004-08-14 13:37   ` Marcelo Tosatti
2004-08-16 12:37     ` Hugh Dickins

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=20040813180504.GB29875@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=linux-mm@kvack.org \
    /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.