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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0C7AC433EF for ; Wed, 15 Jun 2022 07:48:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 203076B0071; Wed, 15 Jun 2022 03:48:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B35A6B0072; Wed, 15 Jun 2022 03:48:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 07B216B0073; Wed, 15 Jun 2022 03:48:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id ED1756B0071 for ; Wed, 15 Jun 2022 03:48:08 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id B07286134D for ; Wed, 15 Jun 2022 07:48:08 +0000 (UTC) X-FDA: 79579691856.17.85839A7 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf26.hostedemail.com (Postfix) with ESMTP id A1464140085 for ; Wed, 15 Jun 2022 07:48:07 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LNHRd1chpz1KB3H; Wed, 15 Jun 2022 15:46:05 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 15 Jun 2022 15:48:02 +0800 Subject: Re: [PATCH 5/7] mm/khugepaged: use helper macro __ATTR_RW To: Zach O'Keefe CC: , , , , , , , , , , , References: <20220611084731.55155-1-linmiaohe@huawei.com> <20220611084731.55155-6-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Wed, 15 Jun 2022 15:48:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655279288; a=rsa-sha256; cv=none; b=2vft69YGpBuSRFDHvLvVOcoMXyexOUVP3kNaftfLg+n7ThC8D09WY+ByfivUYNwInHzvJR fuhXXZq2MqFIqZ+vH6d7iZ2j1JuQEpqvtKuOdpXExRqkNsNHnPmL3cKjXhrh5p8qq2weiu iz5ZNavhfKFYCYOx0aTRGvXo8qr6lzs= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655279288; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S7WVXyXOGHdHgRIrE1TwwXqtr64R1yuvAIrAVWlQJnU=; b=kx0slqh0gWKxSQ0aBZi99lKnvGIBd7S5sYw/ywpKeyez0AdUwftUFaLax7IuFXYvgkx4Io LpQwfjS/bovV4H4570YrRVHboe9GPIwjeSN0j+FIuZy3lI1KC+1nyNR0VxLmMPydNeMUWP M300NsbAWYk1p8MSVdM7tJLr7o0YXdc= X-Stat-Signature: 3ruhxcut757mkgdwpxtz35uhy71jo4uz X-Rspamd-Queue-Id: A1464140085 Authentication-Results: imf26.hostedemail.com; dkim=none; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1655279287-304896 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 2022/6/15 8:29, Zach O'Keefe wrote: > On 11 Jun 16:47, Miaohe Lin wrote: >> Use helper macro __ATTR_RW to define the khugepaged attributes. Minor >> readability improvement. >> >> Signed-off-by: Miaohe Lin >> --- >> mm/khugepaged.c | 37 +++++++++++++++---------------------- >> 1 file changed, 15 insertions(+), 22 deletions(-) >> >> diff --git a/mm/khugepaged.c b/mm/khugepaged.c >> index 8e6fad7c7bd9..142e26e4bdbf 100644 >> --- a/mm/khugepaged.c >> +++ b/mm/khugepaged.c >> @@ -147,8 +147,7 @@ static ssize_t scan_sleep_millisecs_store(struct kobject *kobj, >> return count; >> } >> static struct kobj_attribute scan_sleep_millisecs_attr = >> - __ATTR(scan_sleep_millisecs, 0644, scan_sleep_millisecs_show, >> - scan_sleep_millisecs_store); >> + __ATTR_RW(scan_sleep_millisecs); >> >> static ssize_t alloc_sleep_millisecs_show(struct kobject *kobj, >> struct kobj_attribute *attr, >> @@ -175,8 +174,7 @@ static ssize_t alloc_sleep_millisecs_store(struct kobject *kobj, >> return count; >> } >> static struct kobj_attribute alloc_sleep_millisecs_attr = >> - __ATTR(alloc_sleep_millisecs, 0644, alloc_sleep_millisecs_show, >> - alloc_sleep_millisecs_store); >> + __ATTR_RW(alloc_sleep_millisecs); >> >> static ssize_t pages_to_scan_show(struct kobject *kobj, >> struct kobj_attribute *attr, >> @@ -200,8 +198,7 @@ static ssize_t pages_to_scan_store(struct kobject *kobj, >> return count; >> } >> static struct kobj_attribute pages_to_scan_attr = >> - __ATTR(pages_to_scan, 0644, pages_to_scan_show, >> - pages_to_scan_store); >> + __ATTR_RW(pages_to_scan); >> >> static ssize_t pages_collapsed_show(struct kobject *kobj, >> struct kobj_attribute *attr, >> @@ -221,13 +218,13 @@ static ssize_t full_scans_show(struct kobject *kobj, >> static struct kobj_attribute full_scans_attr = >> __ATTR_RO(full_scans); >> >> -static ssize_t khugepaged_defrag_show(struct kobject *kobj, >> +static ssize_t defrag_show(struct kobject *kobj, >> struct kobj_attribute *attr, char *buf) >> { >> return single_hugepage_flag_show(kobj, attr, buf, >> TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG); >> } >> -static ssize_t khugepaged_defrag_store(struct kobject *kobj, >> +static ssize_t defrag_store(struct kobject *kobj, >> struct kobj_attribute *attr, >> const char *buf, size_t count) >> { >> @@ -235,8 +232,7 @@ static ssize_t khugepaged_defrag_store(struct kobject *kobj, >> TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG); >> } >> static struct kobj_attribute khugepaged_defrag_attr = >> - __ATTR(defrag, 0644, khugepaged_defrag_show, >> - khugepaged_defrag_store); >> + __ATTR_RW(defrag); >> >> /* >> * max_ptes_none controls if khugepaged should collapse hugepages over >> @@ -246,13 +242,13 @@ static struct kobj_attribute khugepaged_defrag_attr = >> * runs. Increasing max_ptes_none will instead potentially reduce the >> * free memory in the system during the khugepaged scan. >> */ >> -static ssize_t khugepaged_max_ptes_none_show(struct kobject *kobj, >> +static ssize_t max_ptes_none_show(struct kobject *kobj, >> struct kobj_attribute *attr, >> char *buf) >> { >> return sysfs_emit(buf, "%u\n", khugepaged_max_ptes_none); >> } >> -static ssize_t khugepaged_max_ptes_none_store(struct kobject *kobj, >> +static ssize_t max_ptes_none_store(struct kobject *kobj, >> struct kobj_attribute *attr, >> const char *buf, size_t count) >> { >> @@ -268,17 +264,16 @@ static ssize_t khugepaged_max_ptes_none_store(struct kobject *kobj, >> return count; >> } >> static struct kobj_attribute khugepaged_max_ptes_none_attr = >> - __ATTR(max_ptes_none, 0644, khugepaged_max_ptes_none_show, >> - khugepaged_max_ptes_none_store); >> + __ATTR_RW(max_ptes_none); >> >> -static ssize_t khugepaged_max_ptes_swap_show(struct kobject *kobj, >> +static ssize_t max_ptes_swap_show(struct kobject *kobj, >> struct kobj_attribute *attr, >> char *buf) >> { >> return sysfs_emit(buf, "%u\n", khugepaged_max_ptes_swap); >> } >> >> -static ssize_t khugepaged_max_ptes_swap_store(struct kobject *kobj, >> +static ssize_t max_ptes_swap_store(struct kobject *kobj, >> struct kobj_attribute *attr, >> const char *buf, size_t count) >> { >> @@ -295,17 +290,16 @@ static ssize_t khugepaged_max_ptes_swap_store(struct kobject *kobj, >> } >> >> static struct kobj_attribute khugepaged_max_ptes_swap_attr = >> - __ATTR(max_ptes_swap, 0644, khugepaged_max_ptes_swap_show, >> - khugepaged_max_ptes_swap_store); >> + __ATTR_RW(max_ptes_swap); >> >> -static ssize_t khugepaged_max_ptes_shared_show(struct kobject *kobj, >> +static ssize_t max_ptes_shared_show(struct kobject *kobj, >> struct kobj_attribute *attr, >> char *buf) >> { >> return sysfs_emit(buf, "%u\n", khugepaged_max_ptes_shared); >> } >> >> -static ssize_t khugepaged_max_ptes_shared_store(struct kobject *kobj, >> +static ssize_t max_ptes_shared_store(struct kobject *kobj, >> struct kobj_attribute *attr, >> const char *buf, size_t count) >> { >> @@ -322,8 +316,7 @@ static ssize_t khugepaged_max_ptes_shared_store(struct kobject *kobj, >> } >> >> static struct kobj_attribute khugepaged_max_ptes_shared_attr = >> - __ATTR(max_ptes_shared, 0644, khugepaged_max_ptes_shared_show, >> - khugepaged_max_ptes_shared_store); >> + __ATTR_RW(max_ptes_shared); >> >> static struct attribute *khugepaged_attr[] = { >> &khugepaged_defrag_attr.attr, >> -- >> 2.23.0 >> >> > > For function names that changed, can we align args that don't fit on opening > line with the opening brace? Sorry, I forgot to fit on opening line with the opening brace and checkpatch.pl didn't complain about it. Will fix these and similar case in another thread. Many thanks for your review and comment! > > Thanks, > Zach > . >