linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	Zhaoyang Huang <huangzhaoyang@gmail.com>,
	steve.kang@unisoc.com
Subject: Re: [RFC PATCHv2 1/1] fs: ext4: Don't use CMA for buffer_head
Date: Mon, 2 Sep 2024 22:29:02 -0400	[thread overview]
Message-ID: <20240903022902.GP9627@mit.edu> (raw)
In-Reply-To: <20240823082237.713543-1-zhaoyang.huang@unisoc.com>

On Fri, Aug 23, 2024 at 04:22:37PM +0800, zhaoyang.huang wrote:
>  
> +#ifndef CONFIG_CMA
>  	bh = sb_getblk(inode->i_sb, map.m_pblk);
> +#else
> +	bh = sb_getblk_gfp(inode->i_sb, map.m_pblk, 0);
> +#endif

So all of these patches to try to work around your issue with CMA are
a bit ugly.  But passing in a GFP mask of zero is definitely not the
right way to go about thing, since there might be certain GFP masks
that are required by a particular block device.  What I think you are
trying to do is to avoid setting the __GFP_MOVEABLE flag.  So in that
case, in the CMA path something like this is what you want:

	bh = getblk_unmoveable(sb->s_bdev, map.m_pblk, sb->s_blocksize);

I'd also sugest only trying to use this is the file system has
journaling enabled.  If the file system is an ext2 file system without
a journal, there's no reason avoid using the CMA region --- and I
assume the reason why the buffer cache is trying to use the moveable
flag is because the amount of non-CMA memory might be a precious
resource in some systems.

				- Ted

  parent reply	other threads:[~2024-09-03  2:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23  8:22 [RFC PATCHv2 1/1] fs: ext4: Don't use CMA for buffer_head zhaoyang.huang
2024-08-23  8:53 ` Zhaoyang Huang
2024-09-03  2:29 ` Theodore Ts'o [this message]
2024-09-03  8:50   ` Zhaoyang Huang
2024-09-03 12:08     ` Theodore Ts'o
2024-09-04  0:49       ` Zhaoyang Huang
2024-09-04  2:44         ` Theodore Ts'o
2024-09-04  6:56           ` Zhaoyang Huang
2024-09-12  8:41             ` Jan Kara
2024-09-12  9:10               ` Zhaoyang Huang
2024-09-12 10:16                 ` Jan Kara
2024-09-13  1:39                   ` Zhaoyang Huang
2024-09-13 10:49                     ` Jan Kara

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=20240903022902.GP9627@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=huangzhaoyang@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=steve.kang@unisoc.com \
    --cc=zhaoyang.huang@unisoc.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;
as well as URLs for NNTP newsgroup(s).