linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: yangerkun <yangerkun@huawei.com>
To: Joe Perches <joe@perches.com>,
	Matthew Wilcox <willy@infradead.org>,
	"Greg KH" <gregkh@linuxfoundation.org>
Cc: <stable@vger.kernel.org>, <vbabka@suse.cz>, <linux-mm@kvack.org>,
	<open-iscsi@googlegroups.com>, <cleech@redhat.com>,
	"zhangyi (F)" <yi.zhang@huawei.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	<liuyongqiang13@huawei.com>,
	"Zhengyejian (Zetta)" <zhengyejian1@huawei.com>,
	Yang Yingliang <yangyingliang@huawei.com>,
	<chenzhou10@huawei.com>
Subject: Re: [QUESTION] WARNNING after 3d8e2128f26a ("sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output")
Date: Wed, 7 Apr 2021 21:49:35 +0800	[thread overview]
Message-ID: <91f1d0e6-1ed3-7f32-029a-370169b9c00a@huawei.com> (raw)
In-Reply-To: <cf36c95f3f92bd76f2d6c81c5795acefbe358f09.camel@perches.com>



在 2021/4/7 21:21, Joe Perches 写道:
> On Wed, 2021-04-07 at 20:14 +0800, yangerkun wrote:
>>
>> 在 2021/4/2 22:41, Matthew Wilcox 写道:
>>> On Fri, Apr 02, 2021 at 09:45:12AM +0200, Greg KH wrote:
>>>> Why is the buffer alignment considered a "waste" here?  If that change
>>>> is in Linus's tree and newer kernels (it showed up in 5.4 which was
>>>> released quite a while ago), where are the people complaining about it
>>>> there?
>>>>
>>>> I think backporting 59bb47985c1d ("mm, sl[aou]b: guarantee natural
>>>> alignment for kmalloc(power-of-two)") seems like the correct thing to do
>>>> here to bring things into alignment (pun intended) with newer kernels.
>>>
>>> It's only a waste for slabs which need things like redzones (eg we could
>>> get 7 512-byte allocations out of a 4kB page with a 64 byte redzone
>>> and no alignment ; with alignment we can only get four).  Since slub
>>> can enable/disable redzones on a per-slab basis, and redzones aren't
>>> terribly interesting now that we have kasan/kfence, nobody really cares.
>>>
>>> .
>>>
>>
>> Thanks for your explain! The imfluence seems minimal since the "waste"
>> will happen only when we enable slub_debug.
>>
>> One more question for Joe Perches. Patch v2[1] does not add the
>> alignment check for buf and we add it in v3[2]. I don't see the
>> necessity for this check... Can you help to explain that why we need this?
> 
> It's to make sure it's a PAGE_SIZE aligned buffer.
> It's just so it would not be misused/abused in non-sysfs derived cases.
> 
> .
> 

Thanks! It help me to understand the problem better!


      reply	other threads:[~2021-04-07 13:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02  7:16 yangerkun
2021-04-02  7:24 ` yangerkun
2021-04-02  7:45 ` Greg KH
2021-04-02 14:41   ` Matthew Wilcox
2021-04-07 12:14     ` yangerkun
2021-04-07 13:21       ` Joe Perches
2021-04-07 13:49         ` yangerkun [this message]

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=91f1d0e6-1ed3-7f32-029a-370169b9c00a@huawei.com \
    --to=yangerkun@huawei.com \
    --cc=chenzhou10@huawei.com \
    --cc=cleech@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-mm@kvack.org \
    --cc=liuyongqiang13@huawei.com \
    --cc=open-iscsi@googlegroups.com \
    --cc=stable@vger.kernel.org \
    --cc=vbabka@suse.cz \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    --cc=yangyingliang@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=zhengyejian1@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox