Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp226032ybh; Tue, 10 Mar 2020 23:32:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs8PoNIpT6MIO7K2p5hUcny1wxrFsleyuR6sqk+mi35g9kNtjc6napfGItuaOnvdQNzuNBU X-Received: by 2002:a9d:12b4:: with SMTP id g49mr1222934otg.50.1583908336356; Tue, 10 Mar 2020 23:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583908336; cv=none; d=google.com; s=arc-20160816; b=lfqpIV6J/IVZZ9+IIfdcDTYPx32C/7nDYuZ5p138rWkDUl92HxrmkUVXc/xuFVWT/6 n5HS2P0ySkUtkrcxEQKOI3V97fpWm97XTmQLSbfia6Q8qsRnA7oipsupIx18FL/RtSxL IKn/Zhgurk7WT2oUZStEEP9tyAw39ppD1u+uMqOWmBfYnauVmLU/ojfv6jtBD+DdG3fg Aa2iitvYC6m2OEteeZPvffmAovDwzZp0VpPIThrgnWkW3UCL6vaEt7nR8AWAq0c7f87U poy/Jdth5RdTDk6XFbvWAMaZMYqhbI6RwO1XvXGvg0aqJs8NrNwCyn/Vqz1PQE0GB3zG uGJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=ywElNuuu6xC+7y9La5cN9vDGAgcPYYjoEwgs7wpUAG8=; b=YD6uShccp1btP02azxLCyP69MsylT+jdo3oWtoxN3oYYrmguQ7J3yMKXJZQDaz1rLk do6UJZY2jsN2CSLGxkaeuKRDYMdIEuQzfT6ztGyLvFMPLhjZovct6Kf5fiNCCtnxNGDd OD7IPa2UyyHItHibJvjj6L7pY48XepddC2FwKtTvUZGIUwQty1hwLatfX9WhRMVxLCJu G1r09W68Ty7Ef3+KuRHGt5JvAvlLyFR/JxACOrQOC555DtH3Aj14kkvUkzQfQS0tk2mb MqqfhOq8NuyLNC7RaBwIr2sASerXZ3EUP5OChq1wIHTQk/UGeiafA1wOMikeEFSJhIzU KYcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=dHyW0iGq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n15si610147otr.262.2020.03.10.23.32.04; Tue, 10 Mar 2020 23:32:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=dHyW0iGq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728178AbgCKGbP (ORCPT + 99 others); Wed, 11 Mar 2020 02:31:15 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:59487 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726160AbgCKGbP (ORCPT ); Wed, 11 Mar 2020 02:31:15 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20200311063112epoutp030676c4ee7d69580330b02418211cac08~7LC6UBdkF0449504495epoutp03g for ; Wed, 11 Mar 2020 06:31:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20200311063112epoutp030676c4ee7d69580330b02418211cac08~7LC6UBdkF0449504495epoutp03g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1583908272; bh=ywElNuuu6xC+7y9La5cN9vDGAgcPYYjoEwgs7wpUAG8=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=dHyW0iGq5F1QyC4ew5UYvBXAfh5Gg1KD9lsNpVTk6pUv03ntQdGglU9BGGkudFO+D bLP2dPEkK0GkFiAOz4/da9IR0xjGr0tyAVRVhVUBkcw/OO4lBbdvkBeQe8aqXGpfGy TMxGRRXTI/DIGUWyTFQRsMPj7mWo9QHSRKR/fItk= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20200311063111epcas1p31c1b524581b95b95d9b8d86d123b8c24~7LC5zXWxt0636906369epcas1p35; Wed, 11 Mar 2020 06:31:11 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.40.164]) by epsnrtp3.localdomain (Postfix) with ESMTP id 48chtR1gpPzMqYkj; Wed, 11 Mar 2020 06:31:11 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 71.65.51241.FA5886E5; Wed, 11 Mar 2020 15:31:11 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200311063110epcas1p157083632cf0a810c04f7adc654aaa2d6~7LC4ukLAJ0619506195epcas1p1h; Wed, 11 Mar 2020 06:31:10 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200311063110epsmtrp24d00c7240bd278954eb2b2844f96a679~7LC4tyRu31738017380epsmtrp2s; Wed, 11 Mar 2020 06:31:10 +0000 (GMT) X-AuditID: b6c32a39-14bff7000001c829-bf-5e6885afdcd7 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id BC.AC.10238.EA5886E5; Wed, 11 Mar 2020 15:31:10 +0900 (KST) Received: from [10.253.104.82] (unknown [10.253.104.82]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200311063109epsmtip1df6b2bd2350ee98f5d146dda7ef7c4a2~7LC3xrjfX2187521875epsmtip1Y; Wed, 11 Mar 2020 06:31:09 +0000 (GMT) Subject: Re: [RFC PATCH 1/3] proc/meminfo: introduce extra meminfo To: Sergey Senozhatsky Cc: adobriyan@gmail.com, akpm@linux-foundation.org, labbott@redhat.com, sumit.semwal@linaro.org, minchan@kernel.org, ngupta@vflare.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com From: Jaewon Kim Message-ID: <5E68859A.9050107@samsung.com> Date: Wed, 11 Mar 2020 15:30:50 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20200311062509.GB83589@google.com> Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFJsWRmVeSWpSXmKPExsWy7bCmnu761ow4g9X/uC2mN3pZzFm/hs2i e/NMRouVe34wWVzeNYfN4t6a/6wWy76+Z7fY0DKL3eLRhElMFqfufmZ34PLYOesuu8emVZ1s Hps+TWL3uHNtD5vHiRm/WTze77vK5rHz02ZWj8+b5AI4onJsMlITU1KLFFLzkvNTMvPSbZW8 g+Od403NDAx1DS0tzJUU8hJzU22VXHwCdN0yc4BuVFIoS8wpBQoFJBYXK+nb2RTll5akKmTk F5fYKqUWpOQUGBoU6BUn5haX5qXrJefnWhkaGBiZAlUm5GRsObmOqaCRu+L9vD7mBsaXHF2M nBwSAiYSRxqXMHUxcnEICexglFhzYRc7hPOJUeLkpTdQzjdGiRcfv7LAtFy68ZgdxBYS2Mso seWoIUTRW0aJlrV7WUESwgJOEnsffWMEsUUErCTurLrGAlL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i9bprzBA1ghInZz5hAbE5BQwkdt3bzQhy EbOAusT6eUIgYWYBeYnmrbOZJzAKzkLSMQuhahaSqgWMzKsYJVMLinPTc4sNCwzzUsv1ihNz i0vz0vWS83M3MYKjR0tzB+PlJfGHGAU4GJV4eF/UpccJsSaWFVfmHmKU4GBWEuGNlwcK8aYk VlalFuXHF5XmpBYfYpTmYFES532adyxSSCA9sSQ1OzW1ILUIJsvEwSnVwKiiInO7yfSsjjdr FcO8nu2u9koOx9bU9HPv+uWYrL7k7Z3/hb89pl2bcFbjhNS/pvXBe/uNgmr2epkuuB0xaeu7 Vp5NXK3ss389qf1Y4Zmapvcq51hExqdPrjGs4hycr/j+i0z4k9l7Ynlz9aFK7tbfpu9LjjcZ FPPKXku71nb0yLr9NbsXz1ZiKc5INNRiLipOBAAHD6NKmgIAAA== X-CMS-MailID: 20200311063110epcas1p157083632cf0a810c04f7adc654aaa2d6 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200311034454epcas1p184680d40f89d37eec7f934074c4a9fcf References: <20200311034441.23243-1-jaewon31.kim@samsung.com> <20200311034441.23243-2-jaewon31.kim@samsung.com> <20200311061836.GA83589@google.com> <20200311062509.GB83589@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020년 03월 11일 15:25, Sergey Senozhatsky wrote: > On (20/03/11 15:18), Sergey Senozhatsky wrote: >> On (20/03/11 12:44), Jaewon Kim wrote: >> [..] >>> +#define NAME_SIZE 15 >>> +#define NAME_BUF_SIZE (NAME_SIZE + 2) /* ':' and '\0' */ >>> + >>> +struct extra_meminfo { >>> + struct list_head list; >>> + atomic_long_t *val; >>> + int shift_for_page; >>> + char name[NAME_BUF_SIZE]; >>> + char name_pad[NAME_BUF_SIZE]; >>> +}; >>> + >>> +int register_extra_meminfo(atomic_long_t *val, int shift, const char *name) >>> +{ >>> + struct extra_meminfo *meminfo, *memtemp; >>> + int len; >>> + int error = 0; >>> + >>> + meminfo = kzalloc(sizeof(*meminfo), GFP_KERNEL); >>> + if (!meminfo) { >>> + error = -ENOMEM; >>> + goto out; >>> + } >>> + >>> + meminfo->val = val; >>> + meminfo->shift_for_page = shift; >>> + strncpy(meminfo->name, name, NAME_SIZE); >>> + len = strlen(meminfo->name); >>> + meminfo->name[len] = ':'; >>> + strncpy(meminfo->name_pad, meminfo->name, NAME_BUF_SIZE); >> What happens if there is no NULL byte among the first NAME_SIZE bytes >> of passed `name'? > Ah. The buffer size is NAME_BUF_SIZE, so should be fine. > > -ss Hello yes correct. For your comment of 'spinlock', it may be changed to other lock like rw semaphore. I think there are just couple of writers compared to many readers. Thank you for your comment. > >