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 7B092C43334 for ; Wed, 15 Jun 2022 00:29:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1147C6B0071; Tue, 14 Jun 2022 20:29:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09C876B0072; Tue, 14 Jun 2022 20:29:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E31D46B0073; Tue, 14 Jun 2022 20:29:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CE1086B0071 for ; Tue, 14 Jun 2022 20:29:37 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id AD16D34FA4 for ; Wed, 15 Jun 2022 00:29:37 +0000 (UTC) X-FDA: 79578586794.29.F50AE6E Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf08.hostedemail.com (Postfix) with ESMTP id 281611600A0 for ; Wed, 15 Jun 2022 00:29:37 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id v11-20020a17090a4ecb00b001e2c5b837ccso551334pjl.3 for ; Tue, 14 Jun 2022 17:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dxhxrXlTOKyC77+K4zyxT72ODZS2TX2T4T14AmDweLc=; b=OJ3B/h8Mzq/D47niMnxNxGPAJVmSCVeMouYFywcmbeGR1llOr/t5UdSJVefQmxife1 LtXKocaFTZQjVy3X1EFaA2DpgcbzJviGe+bnM/L0qfWXthDfTlngS/0BAbgs8O68NlXi GTdkt4zhqdHkI/ogwoNE/rvirRwd2cy6d9GbMYdidFAdZznMPh+g33SBQtBuSTNEvLiI f6Sp9KVxHvtRTP0xm1+3+eMIFtNTvKJ6Y5gaSucRs6mpPzKkpVHpx5LMa2nCdKPKUjSz cpZyD9ks2GF6alN2pEKbi6r9QKGq1GuaFqcWn+vXLFgBJ6y087SBoDhQN1BHodpwuuhf vovQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dxhxrXlTOKyC77+K4zyxT72ODZS2TX2T4T14AmDweLc=; b=vk5CoNDnxq67rxaJ3KdwtpJmBP5XI5lo5xydb//hIYKZeJzlkoLKS872l7IngZ37vk OYd7Bo+Oc214urbT6R0p2Yh/crq9qS00ScaATmBamo6U3LEbj3Dw/bntdVW/yzG6XiVz o4gZPDBuSj5rNfIBcW18H4+tuXbbzG5/JeG4DiYstLu0eo8VZfEO9LUwtPOjtZkyhcvD UWBFai6cjUQFsGc+yBEJwWEBvTPfEPV9Gh2L4psTn526O3NZbgiiyMU4jPcYCAnj//4E H9+GBzlAtvPtAE01+XO1uBhxxbs7MFsogG1IAv4HwdSjnY38xEQnKkI8au628fDZPocM CWog== X-Gm-Message-State: AJIora9ivmoYUJO+ysWvQ0xDxSzgM/h8ZLEln49n3r2zICwQgkSBmYqf inev/v+Kx291BWKepiAWilEWNg== X-Google-Smtp-Source: AGRyM1sMlGm77Mw3gkrg0EHNJVM7rmExx8ODE7hZi9Wqr0iy4jHhaEdSq8fk8shV/YfRljTe3fNIew== X-Received: by 2002:a17:90a:740e:b0:1e2:a631:87e6 with SMTP id a14-20020a17090a740e00b001e2a63187e6mr7249027pjg.115.1655252975722; Tue, 14 Jun 2022 17:29:35 -0700 (PDT) Received: from google.com (55.212.185.35.bc.googleusercontent.com. [35.185.212.55]) by smtp.gmail.com with ESMTPSA id p7-20020a17090a428700b001e2f383110bsm215946pjg.11.2022.06.14.17.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 17:29:34 -0700 (PDT) Date: Tue, 14 Jun 2022 17:29:31 -0700 From: Zach O'Keefe To: Miaohe Lin Cc: akpm@linux-foundation.org, aarcange@redhat.com, willy@infradead.org, vbabka@suse.cz, dhowells@redhat.com, neilb@suse.de, apopple@nvidia.com, david@redhat.com, surenb@google.com, peterx@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/7] mm/khugepaged: use helper macro __ATTR_RW Message-ID: References: <20220611084731.55155-1-linmiaohe@huawei.com> <20220611084731.55155-6-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220611084731.55155-6-linmiaohe@huawei.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655252977; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dxhxrXlTOKyC77+K4zyxT72ODZS2TX2T4T14AmDweLc=; b=6l17cPck6lar8ySVoC48u7qa53K+V+UfZZm4cJh4uGqPXX3IFn9x6q2bGUoJiI2eLIJDw0 tYH3jSkMa9qPR4actB9CEp0c5Hm1476Wez0uei197U+8ZVBM6/Q2uqTgIKDa6HjImD6Jjx +Lu6p9g4s3/Bd9ff3UPJM4L/+D8S3tA= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="OJ3B/h8M"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf08.hostedemail.com: domain of zokeefe@google.com designates 209.85.216.53 as permitted sender) smtp.mailfrom=zokeefe@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655252977; a=rsa-sha256; cv=none; b=Md13y0kK5ZPaiIehuXbFNSNQU71PxsOWyd3yDGweC6vdGRaICZ9mNkQSePfowX72InHG17 RvyDHkjLxG5/oH2nMOVpF+6C+f9zoerYYIhPZVjPqLEQWcetspCYrVo6So2fr1h32T22IL vi63b8kN37ddrmksiVE8JP0V47I7MzQ= X-Rspamd-Queue-Id: 281611600A0 X-Rspam-User: X-Stat-Signature: 4zcbkoy7j7xdfbhfykagpgk4acuimjyn Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="OJ3B/h8M"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf08.hostedemail.com: domain of zokeefe@google.com designates 209.85.216.53 as permitted sender) smtp.mailfrom=zokeefe@google.com X-Rspamd-Server: rspam04 X-HE-Tag: 1655252977-65704 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 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? Thanks, Zach