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 CCB3BC433F5 for ; Fri, 7 Jan 2022 21:01:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB1AD6B0071; Fri, 7 Jan 2022 16:01:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E60C16B0073; Fri, 7 Jan 2022 16:01:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D29026B0074; Fri, 7 Jan 2022 16:01:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by kanga.kvack.org (Postfix) with ESMTP id C50D96B0071 for ; Fri, 7 Jan 2022 16:01:36 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 82779181F24AA for ; Fri, 7 Jan 2022 21:01:36 +0000 (UTC) X-FDA: 79004712192.29.0B3D3BF Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf29.hostedemail.com (Postfix) with ESMTP id 29153120013 for ; Fri, 7 Jan 2022 21:01:36 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id k21so19984710lfu.0 for ; Fri, 07 Jan 2022 13:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FYsF1MlT+oLQPwSGSddilNMw95xcZJ7HznnO1uWFm8I=; b=LqPRfxLi7DqJd/HOUZ4XQQZr8ti7zG35Z3qK0sVpES24j5Upfyf0FtmjG+/v1/c8xo FQ6TNwCDfycxtsS46VnAWtXF4bQoBY4ZrzcHWoN9SDLz8d1R4jMlZVJYVLtlR9H22BNt IPXPe53nvH8iIFC5uc2u/jeeVahF+dmZzGcDNftD9+JJ99D+O5u8GBth4ZbM4UQL3LfL R2MvPUsqS9FNw5xaBA1rdWSJx0UM/T/KMpn+W5JB9k3515exOAN6eLyqc+hOeIThG2GZ W/x+ZpA473eJ2KqUEuClza6+0fc3t3Ii3TuO8kStStDuZziYeTCkR+Fr8cpUUV9NsKjD tfvQ== 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:user-agent; bh=FYsF1MlT+oLQPwSGSddilNMw95xcZJ7HznnO1uWFm8I=; b=Kt8tMRMG/R11UC2TRIIGs87MhuOVxMnhebzz0uk8oWI901kqDSEbSA8fOg6kVwiWA3 xMOUMSfntPruim8z7bBR49CTY4Y+8qL2M8lNqvtf9kc7ZTAA1XueBQXHZrQGMTIjIsIm zrBG4dVAmw3/aTFHTCqStpCgkUHBULtdNJgKyBaee9dTmhVThhyZObVjawvEkTCBBem4 fMNBz0xjuHoYAatzoMQ2+Ix0DbFfAtVwmEuaHRPISFyMsY8GqrkbV/KF+veWMEb/rd+P AZSWbgcOHP7XoGtj5uMXXo0IpduEaetOh24NoqjCMZPo7z1dQZONvbWJ4ZdbNUdsnm1k xMJA== X-Gm-Message-State: AOAM533YGi619uRtymZ+cacUN33PagwwY9E8+MTc6YwF9giFXL3pw+6+ ifdVDANayQKecYHwF9buPII= X-Google-Smtp-Source: ABdhPJwRvJP9mJ8cEjfVRCF5EIlJvc6FB1T2y3fbShFHTpOnWBVuSA8ajnjQadoPfpau2lk6IYBodQ== X-Received: by 2002:a19:380e:: with SMTP id f14mr57642917lfa.612.1641589294390; Fri, 07 Jan 2022 13:01:34 -0800 (PST) Received: from grain.localdomain ([5.18.251.97]) by smtp.gmail.com with ESMTPSA id i7sm712214lfu.175.2022.01.07.13.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 13:01:33 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id DCFD75A0020; Sat, 8 Jan 2022 00:01:32 +0300 (MSK) Date: Sat, 8 Jan 2022 00:01:32 +0300 From: Cyrill Gorcunov To: Pintu Kumar Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, ebiederm@xmission.com, christian.brauner@ubuntu.com, sfr@canb.auug.org.au, legion@kernel.org, sashal@kernel.org, chris.hyser@oracle.com, ccross@google.com, pcc@google.com, dave@stgolabs.net, caoxiaofeng@yulong.com, david@redhat.com, pintu.ping@gmail.com, vbabka@suse.cz, linux-api@vger.kernel.org Subject: Re: [PATCH v2] sysinfo: include availram field in sysinfo struct Message-ID: References: <1641483250-18839-1-git-send-email-quic_pintu@quicinc.com> <1641578854-14232-1-git-send-email-quic_pintu@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1641578854-14232-1-git-send-email-quic_pintu@quicinc.com> User-Agent: Mutt/2.0.7 (2021-05-04) X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 29153120013 X-Stat-Signature: fnkj998osywa9c9cawhhczxn8pwgppwd Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LqPRfxLi; spf=pass (imf29.hostedemail.com: domain of gorcunov@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=gorcunov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1641589295-762610 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, Jan 07, 2022 at 11:37:34PM +0530, Pintu Kumar wrote: > The sysinfo member does not have any "available ram" field and > the bufferram field is not much helpful either, to get a rough > estimate of available ram needed for allocation. > > One needs to parse MemAvailable field separately from /proc/meminfo > to get this info instead of directly getting if from sysinfo itself. Who exactly needs this change? Do you have some application for which parsing /proc/meminfo is a hot path so it needs this information via sysinfo interface? Don't get me wrong please but such extension really need a strong justification because they are part of UAPI and there is not that much space left in sysinfo structure. We will _have_ to live with this new field forever so I propose to not introduce anything new here until we have no other choise or parsing meminfo become a really bottleneck. > diff --git a/kernel/sys.c b/kernel/sys.c > index ecc4cf0..7059515 100644 > --- a/kernel/sys.c > +++ b/kernel/sys.c > @@ -2671,6 +2671,7 @@ static int do_sysinfo(struct sysinfo *info) > info->freeram <<= bitcount; > info->sharedram <<= bitcount; > info->bufferram <<= bitcount; > + info->availram <<= bitcount; > info->totalswap <<= bitcount; > info->freeswap <<= bitcount; > info->totalhigh <<= bitcount; > @@ -2700,6 +2701,7 @@ struct compat_sysinfo { > u32 freeram; > u32 sharedram; > u32 bufferram; > + u32 availram; If only I'm not missing something ovious, this is part of UAPI as well.