All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 2/3] f2fs: use __set_page_dirty_nobuffers directly
Date: Thu, 3 Nov 2016 10:57:04 -0700	[thread overview]
Message-ID: <20161103175704.GB76264@jaegeuk> (raw)
In-Reply-To: <13561186-caab-79b4-325f-6d0514aa289b@huawei.com>

On Thu, Nov 03, 2016 at 05:50:34PM +0800, Chao Yu wrote:
> On 2016/11/3 1:23, Jaegeuk Kim wrote:
> > On Wed, Nov 02, 2016 at 03:34:32PM +0800, Chao Yu wrote:
> >> Hi Jaegeuk,
> >>
> >> On 2016/10/21 10:28, Jaegeuk Kim wrote:
> >>> This patch replaces the copied code with original generic function.
> >>
> >> Will we plan to do further enhance inside f2fs_set_page_dirty_nobuffers, if we
> >> don't it's better revert fe76b796fc5194cc3d57265002e3a748566d073f, as we don't
> >> need to wrap __set_page_dirty_nobuffers.
> > 
> > Urg. I was confused something here.
> > Please ignore this patch. I won't merge this patch.
> 
> Why? isn't __set_page_dirty_nobuffers more fit for f2fs' non-buffer management?

For a while ago, when I tried to improve the performance on pmem, I could hit
that __set_page_dirty_buffers() slightly improved the bandwidth comparing to
__set_page_dirty_nobuffers().

When referencing the below comment written in __set_page_dirty_nobuffers(), it
seems I could get that by adopting "top-down" approach instead of "bottom-up",
which avoids lock contention as I guess. I couldn't do deep investigation on it
though.

/*
 * For address_spaces which do not use buffers.  Just tag the page as dirty in
 * its radix tree.
 *
 * This is also used when a single buffer is being dirtied: we want to set the
 * page dirty in that case, but not all the buffers.  This is a "bottom-up"
 * dirtying, whereas __set_page_dirty_buffers() is a "top-down" dirtying.
 *
 * The caller must ensure this doesn't race with truncation.  Most will simply
 * hold the page lock, but e.g. zap_pte_range() calls with the page mapped and
 * the pte lock held, which also locks out truncation.
 */

So, I measured the performance again with fxmark on ramdisk, 8 cores, DWAL,
bufferedio case. I got 2683158 works/sec w/ "top-down" over 2512609 works/sec w/
"bottom-up".

Thanks,

> 
> Thanks,
> 
> > 
> >> BTW, does the original patch make memory cgroup functionality problematic?
> > 
> > I don't think there is a problem, since I just copied __set_page_dirty_buffers()
> > except page_has_buffers' stuffs.
> > 
> > Thank you for pointing this out. :)
> > 
> >>
> >> Thanks,
> >>
> >>>
> >>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >>> ---
> >>>  fs/f2fs/data.c | 29 -----------------------------
> >>>  fs/f2fs/f2fs.h |  6 +++++-
> >>>  2 files changed, 5 insertions(+), 30 deletions(-)
> >>>
> >>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >>> index 68edb47..3954315 100644
> >>> --- a/fs/f2fs/data.c
> >>> +++ b/fs/f2fs/data.c
> >>> @@ -1801,35 +1801,6 @@ int f2fs_release_page(struct page *page, gfp_t wait)
> >>>  	return 1;
> >>>  }
> >>>  
> >>> -/*
> >>> - * This was copied from __set_page_dirty_buffers which gives higher performance
> >>> - * in very high speed storages. (e.g., pmem)
> >>> - */
> >>> -void f2fs_set_page_dirty_nobuffers(struct page *page)
> >>> -{
> >>> -	struct address_space *mapping = page->mapping;
> >>> -	unsigned long flags;
> >>> -
> >>> -	if (unlikely(!mapping))
> >>> -		return;
> >>> -
> >>> -	spin_lock(&mapping->private_lock);
> >>> -	lock_page_memcg(page);
> >>> -	SetPageDirty(page);
> >>> -	spin_unlock(&mapping->private_lock);
> >>> -
> >>> -	spin_lock_irqsave(&mapping->tree_lock, flags);
> >>> -	WARN_ON_ONCE(!PageUptodate(page));
> >>> -	account_page_dirtied(page, mapping);
> >>> -	radix_tree_tag_set(&mapping->page_tree,
> >>> -			page_index(page), PAGECACHE_TAG_DIRTY);
> >>> -	spin_unlock_irqrestore(&mapping->tree_lock, flags);
> >>> -	unlock_page_memcg(page);
> >>> -
> >>> -	__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
> >>> -	return;
> >>> -}
> >>> -
> >>>  static int f2fs_set_data_page_dirty(struct page *page)
> >>>  {
> >>>  	struct address_space *mapping = page->mapping;
> >>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> >>> index 168f939..b66a04c 100644
> >>> --- a/fs/f2fs/f2fs.h
> >>> +++ b/fs/f2fs/f2fs.h
> >>> @@ -1960,6 +1960,11 @@ static inline unsigned long f2fs_find_next_bit(const void *addr,
> >>>  	return find_next_bit(addr, size, offset + 2);
> >>>  }
> >>>  
> >>> +static inline void f2fs_set_page_dirty_nobuffers(struct page *page)
> >>> +{
> >>> +	__set_page_dirty_nobuffers(page);
> >>> +}
> >>> +
> >>>  #define get_inode_mode(i) \
> >>>  	((is_inode_flag_set(i, FI_ACL_MODE)) ? \
> >>>  	 (F2FS_I(i)->i_acl_mode) : ((i)->i_mode))
> >>> @@ -2200,7 +2205,6 @@ struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool);
> >>>  int do_write_data_page(struct f2fs_io_info *);
> >>>  int f2fs_map_blocks(struct inode *, struct f2fs_map_blocks *, int, int);
> >>>  int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *, u64, u64);
> >>> -void f2fs_set_page_dirty_nobuffers(struct page *);
> >>>  void f2fs_invalidate_page(struct page *, unsigned int, unsigned int);
> >>>  int f2fs_release_page(struct page *, gfp_t);
> >>>  #ifdef CONFIG_MIGRATION
> >>>
> > 
> > .
> > 

  reply	other threads:[~2016-11-03 17:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21  2:28 [PATCH 1/3] f2fs: add fast path for find_next_{zero}bit Jaegeuk Kim
2016-10-21  2:28 ` Jaegeuk Kim
2016-10-21  2:28 ` [PATCH 2/3] f2fs: use __set_page_dirty_nobuffers directly Jaegeuk Kim
2016-10-21  2:28   ` Jaegeuk Kim
2016-11-02  7:34   ` [f2fs-dev] " Chao Yu
2016-11-02  7:34     ` Chao Yu
2016-11-02 17:23     ` Jaegeuk Kim
2016-11-02 17:23       ` [f2fs-dev] " Jaegeuk Kim
2016-11-03  9:50       ` Chao Yu
2016-11-03  9:50         ` Chao Yu
2016-11-03 17:57         ` Jaegeuk Kim [this message]
2016-11-04 15:51           ` Chao Yu
2016-11-04 15:51             ` [f2fs-dev] " Chao Yu
2016-10-21  2:28 ` [PATCH 3/3] f2fs: remove percpu_count due to performance regression Jaegeuk Kim
2016-10-21 10:35 ` [PATCH 1/3] f2fs: add fast path for find_next_{zero}bit Christoph Hellwig

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=20161103175704.GB76264@jaegeuk \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.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.