From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93915C433B4 for ; Fri, 2 Apr 2021 07:45:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1CF0F61106 for ; Fri, 2 Apr 2021 07:45:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CF0F61106 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 897C26B0071; Fri, 2 Apr 2021 03:45:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8471A6B0072; Fri, 2 Apr 2021 03:45:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EA456B0073; Fri, 2 Apr 2021 03:45:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0006.hostedemail.com [216.40.44.6]) by kanga.kvack.org (Postfix) with ESMTP id 4F7216B0071 for ; Fri, 2 Apr 2021 03:45:17 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0714AF036 for ; Fri, 2 Apr 2021 07:45:17 +0000 (UTC) X-FDA: 77986641474.23.C0AAD9B Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf26.hostedemail.com (Postfix) with ESMTP id 3FBC640002D8 for ; Fri, 2 Apr 2021 07:45:15 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id CB30B6100C; Fri, 2 Apr 2021 07:45:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617349515; bh=CHUVzzwOvWHtGtMyC4Dc1Tl18xOORfSsXep5lgLLe2U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kuXPhZGbzsmIlQQ+0YxQDc3oNZiQ5/9V4vc/3qBG9wuRZI6Wg2o9jjUoSqllaZ6tV Y4etNp9PQE5YCP8KxUeDvdXS3Zrozv+RFtarS1sduVbnDjQqtgjazqLtC0fuHgtgmL a8d+1WxuomHRupfDfGz0WgYcJ2u86W0BAYLNhLrU= Date: Fri, 2 Apr 2021 09:45:12 +0200 From: Greg KH To: yangerkun Cc: stable@vger.kernel.org, vbabka@suse.cz, linux-mm@kvack.org, open-iscsi@googlegroups.com, cleech@redhat.com, "zhangyi (F)" , Kefeng Wang , liuyongqiang13@huawei.com, "Zhengyejian (Zetta)" , Yang Yingliang , chenzhou10@huawei.com Subject: Re: [QUESTION] WARNNING after 3d8e2128f26a ("sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output") Message-ID: References: <5837f5d9-2235-3ac2-f3f2-712e6cf4da5c@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5837f5d9-2235-3ac2-f3f2-712e6cf4da5c@huawei.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3FBC640002D8 X-Stat-Signature: 6sdhmgyq58cx6u89dr5gdjy5wzmdtjm7 Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617349515-441653 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Apr 02, 2021 at 03:16:21PM +0800, yangerkun wrote: > sysfs_emit(3d8e2128f26a ("sysfs: Add sysfs_emit and sysfs_emit_at to > format sysfs output")) has a hidden constraint that the buf should be > alignment with PAGE_SIZE. It's OK since 59bb47985c1d ("mm, sl[aou]b: > guarantee natural alignment for kmalloc(power-of-two)") help us to solve > scenes like CONFIG_SLUB_DEBUG or CONFIG_SLOB which will break this. > > > But since lots of stable branch(we reproduce it with 4.19 stable) merge > 3d8e2128f26a ("sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs > output") without 59bb47985c1d ("mm, sl[aou]b: guarantee natural > alignment for kmalloc(power-of-two)"), we will get the follow warning > with command 'cat /sys/class/iscsi_transport/tcp/handle' once we enable > CONFIG_SLUB_DEBUG and start kernel with slub_debug=UFPZ! > > > Obviously, we can backport 59bb47985c1d ("mm, sl[aou]b: guarantee > natural alignment for kmalloc(power-of-two)") to fix it. But this will > waste some memory to ensure natural alignment which seems unbearable for > embedded device. So for stable branch like 4.19, can we just remove the > warning in sysfs_emit since the only user for it is iscsi, and seq_read > + sysfs_kf_seq_show can ensure that the buf in sysfs_emit must be aware > of PAGE_SIZE. Or does there some other advise for this problem? More users of this function will be backported over time as we all know, so just removing the functions is not good. 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. thanks, greg k-h