All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Hirokazu Takahashi <taka@valinux.co.jp>
Cc: iwamoto@valinux.co.jp, haveblue@us.ibm.com, linux-mm@kvack.org
Subject: Re: [PATCH] mhp: transfer dirty tag at radix_tree_replace
Date: Fri, 8 Oct 2004 17:36:10 -0300	[thread overview]
Message-ID: <20041008203610.GA20716@logos.cnet> (raw)
In-Reply-To: <20041008.171525.17587512.taka@valinux.co.jp>

On Fri, Oct 08, 2004 at 05:15:25PM +0900, Hirokazu Takahashi wrote:
> Hi, Marcelo.
> 
> > > > > 1) 
> > > > > I'm pretty sure you should transfer the radix tree tag at radix_tree_replace().
> > > > > If for example you transfer a dirty tagged page to another zone, an mpage_writepages()
> > > > > will miss it (because it uses pagevec_lookup_tag(PAGECACHE_DIRTY_TAG)). 
> > > > > 
> > > > > Should be quite trivial to do (save tags before deleting and set to new entry, 
> > > > > all in radix_tree_replace).
> > > > > 
> > > > > My implementation also contained the same bug.
> > > > 
> > > > Yes, it's one of the issues to do. The tag should be transferred in
> > > > radix_tree_replace() as you pointed out. The current implementation
> > > > sets the tag in set_page_dirty(newpage).
> > > 
> > > OK, guys, can you test this please?
> > 
> > Ok, I'll test it. 
> 
> It was sad that the patch couldn't be compiled because
> PAGECACHE_TAG_DIRTY macro depended on the filesystem code.
> I think radix_tree library shouldn't use it.
> 
> So that it would be better to make radix_tree_replace() accept tags
> to be inherited or make the function from scratch.
> So I decided to re-implement it and I'm testing it now.
> 
> > > This transfer the dirty radix tree tag at radix_tree_replace, avoiding 
> > > a potential miss on tag-lookup.  We could also copy all bits representing 
> > > the valid tags for this node in the radix tree. 
> > > 
> > > But this uses the available interfaces from radix-lib.c. In case 
> > > a new tag gets added, radix_tree_replace() will have to know about it.
> > 
> > Yeah. I guess it would be better to copy the radix_tree_delete()
> > code to radix_tree_replace() and modify it to replace items directly
> > in the future.
> 
> 
> 
> void *radix_tree_replace(struct radix_tree_root *root,
>                                         unsigned long index, void *item)
> {
>         struct radix_tree_path path[RADIX_TREE_MAX_PATH], *pathp = path;
>         unsigned int height, shift;
>         void *ret = NULL;
> 
>         height = root->height;
>         if (index > radix_tree_maxindex(height))
>                 goto out;
> 
>         shift = (height - 1) * RADIX_TREE_MAP_SHIFT;
>         pathp->node = NULL;
>         pathp->slot = &root->rnode;
> 
>         while (height > 0) {
>                 int offset;
> 
>                 if (*pathp->slot == NULL)
>                         goto out;
> 
>                 offset = (index >> shift) & RADIX_TREE_MAP_MASK;
>                 pathp[1].offset = offset;
>                 pathp[1].node = *pathp[0].slot;
>                 pathp[1].slot = (struct radix_tree_node **)
>                                 (pathp[1].node->slots + offset);
>                 pathp++;
>                 shift -= RADIX_TREE_MAP_SHIFT;
>                 height--;
>         }
> 
>         if ((ret = *pathp[0].slot))
>                 *pathp[0].slot = item;
> out:
>         return ret;
> }

I'm not too familiar with the radix internals, but this looks fine to me.

Thanks Hirokazu!
--
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-10-08 20:36 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-01 18:22 [RFC] memory defragmentation to satisfy high order allocations Marcelo Tosatti
2004-10-01 18:22 ` Marcelo Tosatti
2004-10-01 20:11 ` Andrew Morton
2004-10-01 20:11   ` Andrew Morton
2004-10-01 19:04   ` Marcelo Tosatti
2004-10-01 19:04     ` Marcelo Tosatti
2004-10-01 21:00     ` Andrew Morton
2004-10-01 21:00       ` Andrew Morton
2004-10-01 21:57     ` Dave Hansen
2004-10-01 21:57       ` Dave Hansen
2004-10-01 23:42       ` Marcelo Tosatti
2004-10-01 23:42         ` Marcelo Tosatti
2004-10-02  1:17         ` Andrew Morton
2004-10-02  1:17           ` Andrew Morton
2004-10-02  9:30         ` Hirokazu Takahashi
2004-10-02  9:30           ` Hirokazu Takahashi
2004-10-02 18:33           ` Marcelo Tosatti
2004-10-02 18:33             ` Marcelo Tosatti
2004-10-03  4:13             ` Hirokazu Takahashi
2004-10-03  4:13               ` Hirokazu Takahashi
2004-10-03 14:07               ` Marcelo Tosatti
2004-10-03 14:07                 ` Marcelo Tosatti
2004-10-03 18:35                 ` Hirokazu Takahashi
2004-10-03 18:35                   ` Hirokazu Takahashi
2004-10-03 19:21                   ` Trond Myklebust
2004-10-03 19:21                     ` Trond Myklebust
2004-10-03 20:03                     ` Hirokazu Takahashi
2004-10-03 20:03                       ` Hirokazu Takahashi
2004-10-03 20:44                       ` Trond Myklebust
2004-10-03 20:44                         ` Trond Myklebust
2004-10-04 13:02                         ` Hirokazu Takahashi
2004-10-04 13:02                           ` Hirokazu Takahashi
2004-10-04 17:24                   ` Marcelo Tosatti
2004-10-04 17:24                     ` Marcelo Tosatti
2004-10-05  2:53                     ` Hirokazu Takahashi
2004-10-05  2:53                       ` Hirokazu Takahashi
2004-10-07 12:06                       ` Marcelo Tosatti
2004-10-08  7:00                         ` Hirokazu Takahashi
2004-10-08 10:00                           ` Marcelo Tosatti
2004-10-08 12:23                             ` Hirokazu Takahashi
2004-10-08 12:41                               ` Marcelo Tosatti
2004-10-08 16:52                                 ` Hirokazu Takahashi
2004-10-08 15:36                                   ` Marcelo Tosatti
2004-10-12 10:56                                     ` IWAMOTO Toshihiro
2004-10-12 10:35                                       ` Marcelo Tosatti
2004-10-12 17:55                                         ` Hirokazu Takahashi
2004-10-12 14:26                                       ` Martin J. Bligh
2004-10-12 12:17                                         ` Marcelo Tosatti
2004-10-12 15:01                                         ` Dave Hansen
2004-10-04  3:24                 ` IWAMOTO Toshihiro
2004-10-04  3:24                   ` IWAMOTO Toshihiro
2004-10-04  2:22               ` Dave Hansen
2004-10-04  2:22                 ` Dave Hansen
2004-10-05 16:46               ` [PATCH] mhp: transfer dirty tag at radix_tree_replace Marcelo Tosatti
2004-10-05 18:35                 ` Dave Hansen
2004-10-06  7:39                 ` Hirokazu Takahashi
2004-10-08  8:15                   ` Hirokazu Takahashi
2004-10-08 20:36                     ` Marcelo Tosatti [this message]
2004-10-04  4:09             ` [RFC] memory defragmentation to satisfy high order allocations IWAMOTO Toshihiro
2004-10-04  4:09               ` IWAMOTO Toshihiro
2004-10-04 17:29               ` Marcelo Tosatti
2004-10-04 17:29                 ` Marcelo Tosatti
2004-10-02  2:30 ` Nick Piggin
2004-10-02  2:30   ` Nick Piggin
2004-10-02  3:08   ` Marcelo Tosatti
2004-10-02  3:08     ` Marcelo Tosatti
2004-10-04  8:15     ` Nick Piggin
2004-10-04  8:15       ` Nick Piggin
2004-10-02  2:41 ` Nick Piggin
2004-10-02  2:41   ` Nick Piggin
2004-10-02  3:50   ` Hirokazu Takahashi
2004-10-02  3:50     ` Hirokazu Takahashi
2004-10-02 16:06   ` Marcelo Tosatti
2004-10-02 16:06     ` Marcelo Tosatti
2004-10-04  2:38 ` Hiroyuki KAMEZAWA
2004-10-04  2:38   ` Hiroyuki KAMEZAWA
2004-10-04 17:32   ` Marcelo Tosatti
2004-10-04 17:32     ` Marcelo Tosatti
2004-10-04  6:58 ` Hiroyuki KAMEZAWA
2004-10-04  6:58   ` Hiroyuki KAMEZAWA
2004-10-07 15:58   ` memory hotplug and mem= Marcelo Tosatti
2004-10-07 18:36     ` Dave Hansen
2004-10-07 17:01       ` Marcelo Tosatti
2004-10-07 19:10         ` Dave Hansen
2004-10-07 20:25         ` Dave Hansen

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=20041008203610.GA20716@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=haveblue@us.ibm.com \
    --cc=iwamoto@valinux.co.jp \
    --cc=linux-mm@kvack.org \
    --cc=taka@valinux.co.jp \
    /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.