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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAB4CC47404 for ; Wed, 9 Oct 2019 23:17:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4AAD7206C0 for ; Wed, 9 Oct 2019 23:17:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=garybgenett-net.20150623.gappssmtp.com header.i=@garybgenett-net.20150623.gappssmtp.com header.b="AR3RqGxm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4AAD7206C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=garybgenett.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D3F7E6B0003; Wed, 9 Oct 2019 19:17:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CEFE28E0003; Wed, 9 Oct 2019 19:17:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C06D06B0006; Wed, 9 Oct 2019 19:17:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id A28636B0003 for ; Wed, 9 Oct 2019 19:17:16 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 4FE88181AC9AE for ; Wed, 9 Oct 2019 23:17:16 +0000 (UTC) X-FDA: 76025809272.12.group80_5389461ff353 X-HE-Tag: group80_5389461ff353 X-Filterd-Recvd-Size: 4612 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Oct 2019 23:17:15 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id q10so2632186pfl.0 for ; Wed, 09 Oct 2019 16:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garybgenett-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=k5Ujz1s2Da97V1EzP3OEKrWYjMFiMLkIsS3atOkH6KM=; b=AR3RqGxmg4fJI46hXsx5rUjKEuTy5xBTcnI00kR85D84l0I3KJg+93mi2CL264114h S04tRQ1VxkqBoZsaxaRYEcDZhzUOT/AX+4RbiqOrV8ozYyX967XL28KLSGPN/jzvRAxW esS04pJUR0qph2jePMxuZITY0sGlF2AzWN1KpGhXHZ3e8rY+Ods0pVi63giQGQUkTuaR jNsBR4utnjAGNTUPsJZNsDDF85jdicA1K6EYnPSWvwWSFp2yrxKwy0K4AbvOEGmSa0am LCP0p1zL2x0DRt36OVqS1zp8s9psRu2KsSqxs0akgfzQTRW3nCgDofaDTJyHhNMyjOdo GhSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=k5Ujz1s2Da97V1EzP3OEKrWYjMFiMLkIsS3atOkH6KM=; b=k2UefF40onrWTBXpsqIVJBCqpWOEOE+fYeqBHU4PbyC7BcQOci4jRHqRxF+RAkX/Hx 6nhfYnjsTHZkOIMgFk6FfInXCgUsZrV8kR37T2SkQ9hD065+wB0XCVkUfYkaqrrRq9z+ uu/5cMaP5lQ8u+rIh/h27WgrgzvjzJ+YWEw6H9+RtQIbj4XdAJtD02faShtdDQsEq1zM 3TPyyodVaE+Ut1/mA0B4cdbMdmfIej65r09tDpcU4iCMLJJU3H3i4Fwci9L+20JKZ7xI 9RSSkZoByclvOgu5D7Akt917u5ER+HPQM23L6arNi8yYpjJbqLIFrjlh35rg9LX9bv0x xAzA== X-Gm-Message-State: APjAAAUz8b24QaZ5aDuQkU8UK8gM7n1npLewVX4kZfbWhMV7X1TEJAB+ NkAF+kffYgmgUaEKiBV6z6ym4w== X-Google-Smtp-Source: APXvYqypTNIWfmaR0dPXgwvl+CyCu8YfehzuSC9EEQ1wtVcS3HhGkLKO1mUKIZgpFQ0nWamysD8bOg== X-Received: by 2002:a63:6883:: with SMTP id d125mr7071231pgc.350.1570663034185; Wed, 09 Oct 2019 16:17:14 -0700 (PDT) Received: from spider ([71.212.141.220]) by smtp.gmail.com with ESMTPSA id 126sm3501405pgg.10.2019.10.09.16.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Oct 2019 16:17:13 -0700 (PDT) Date: Wed, 9 Oct 2019 16:17:11 -0700 From: -Gary- To: Qian Cai Cc: Vlastimil Babka , Hugh Dickins , linux-mm@kvack.org Subject: Re: [PATCH] shmem: make shmem default size a define value Message-ID: <20191009231710.GH22291@spider> References: <20191009184604.GA5162@spider> <1570647695.5937.16.camel@lca.pw> <20191009201745.GF22291@spider> <1570654587.5937.18.camel@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1570654587.5937.18.camel@lca.pw> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.101331, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > > Should I be pulling from somewhere else, or also re-hacking nr_pages somehow? > > Ah, you are right that nr_pages is still referenced, but then there could a > potentially out of sync? Would that be a problem? Is the compiler just smart > enough to call totalram_pages() only once? > > CPU0: CPU1: > unsigned long nr_pages = totalram_pages(); > totalram_pages_inc() > min(nr_pages - totalhigh_pages(), SHMEM_SIZE_DEFAULT); Ah, I see your point, Qian. Even with my fledgling skills, I should have thought of that. The whole point of the commit I referenced was to make the operation atomic so the values would be identical. I failed there. The only option then, would be to do something like define SHMEM_SIZE_DEFAULT as 50, and call it as *(SHMEM_SIZE_DEFAULT/100), which feels pretty contrived and silly. Good news is that I finally see how it probably ended up as it is. While poking around, I've also started to see this type of math throughout the entire kernel, such as the hibernate subsystem, where 2/5 is used. Since I am not going to take up the task of finding and changing all of them... best to leave well enough alone. This has been a very educational experience. It has been fun to really dig into the MM corner of the kernel, and get to understand things on a deeper level. A lot going on in there! You've been so patient and gracious. Thank you for your time, and walking me through the thinking. I will apply my efforts in other areas. <^) -- Gary