最近闹的比较热闹的事情是,华为有人提交到Linux 上的代码被审核员点名批评刷KPI,并且,这个邮件还上了头条。

华为这个事,是不是刷KPI?_内核

提交的代码修改如下

From: Zhen Lei <thunder.leizhen@huawei.com>
To: Kees Cook <keescook@chromium.org>,
Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH 1/1] pstore: remove unnecessary oom message
Date: Thu, 17 Jun 2021 17:10:54 +0800
Message-ID: <20210617091054.1547-1-thunder.leizhen@huawei.com> (raw)

Fixes scripts/checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message

Remove it can help us save a bit of memory.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
fs/pstore/platform.c | 4 +---
fs/pstore/ram_core.c | 15 ++++-----------
2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index b9614db48b1d..752c2338af6c 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -752,10 +752,8 @@ void pstore_get_backend_records(struct pstore_info *psi,
int rc;

record = kzalloc(sizeof(*record), GFP_KERNEL);
- if (!record) {
- pr_err("out of memory creating record\n");
+ if (!record)
break;
- }
pstore_record_init(record, psi);

record->size = psi->read(record);
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index fe5305028c6e..7da890505025 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -301,10 +301,8 @@ void persistent_ram_save_old(struct persistent_ram_zone *prz)
if (!prz->old_log) {
persistent_ram_ecc_old(prz);
prz->old_log = kmalloc(size, GFP_KERNEL);
- }
- if (!prz->old_log) {
- pr_err("failed to allocate buffer\n");
- return;
+ if (!prz->old_log)
+ return;
}

prz->old_log_size = size;
@@ -429,11 +427,8 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size,
}

pages = kmalloc_array(page_count, sizeof(struct page *), GFP_KERNEL);
- if (!pages) {
- pr_err("%s: Failed to allocate array for %u pages\n",
- __func__, page_count);
+ if (!pages)
return NULL;
- }

for (i = 0; i < page_count; i++) {
phys_addr_t addr = page_start + i * PAGE_SIZE;
@@ -578,10 +573,8 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
int ret = -ENOMEM;

prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL);
- if (!prz) {
- pr_err("failed to allocate persistent ram zone\n");
+ if (!prz)
goto err;
- }

/* Initialize general buffer state. */
raw_spin_lock_init(&prz->buffer_lock);
--
2.25.1

之后,华为的这位同学回复如下

华为这个事,是不是刷KPI?_算法导论_02

对于这个回复,评审员依次回复如下

华为这个事,是不是刷KPI?_kernel_03

主要的意思是,你可以把这些多余的修改去除,我们也是很支持的,但是可以在某一个大的提交上去提交,不要依次提交一点点,这样很不友好。

并提到一个事情,即使我不去查看git log,我也能知道你们对Linux内核的贡献非常非常大,特别是在 EROFS 和 F2FS 上。

对于这件事情,我的看法是

国外的同学明显没有感受到KPI对员工的重要。

没有KPI,那么年终奖就会很低,娃要吃饭喝奶,房子要还贷,作为一个赚钱的机器,多赚钱没有错,这个事情不只是在华为,如果在其他企业,我觉得也会存在,给Linux内核提交patch,那么在KPI上显得多么优雅。

当然,作为内核维护者,他们是痛苦的,他们每天面对很多很多的邮件,要处理很多很多的问题,不能因为你的KPI问题,就没有质量的提交代码,这样对我是不尊重的。

其他的没啥问题,他们都是在自己的角度处理事情。

比较尴尬的是,这个是华为的人暴雷的,毕竟他是华为,这样容易让别人知道我们的实际情况。

对于网上的一些回复,就比较有意思了。

华为这个事,是不是刷KPI?_算法导论_04