Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp171397ima; Tue, 23 Oct 2018 22:18:51 -0700 (PDT) X-Google-Smtp-Source: AJdET5fMcOGSZH3kCeQlRj7wsqUrlQQTnoLe/1zyhRFa9Aaczc7nAB9mGkJwDr6XoErBkagEM5X4 X-Received: by 2002:a62:3301:: with SMTP id z1-v6mr1211144pfz.85.1540358331351; Tue, 23 Oct 2018 22:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540358331; cv=none; d=google.com; s=arc-20160816; b=0uBlIQw0HUI8IXyOYuOBRve/ncHiHa1FWbXG/PleOihGhso+QGgMRuhCCPwvVnR7hD XbfOZXqqozyWmSzHEpopejR+PM8ymocCrMF74lTacnYoyK/lmiLhsIt5K9GLIE5LIm9a gAtubsvlEci4jBwRSxJzsaRnkkGEF0LOW04MAX8hj1YD/r2lm7WkZho97d9IN+xZOjen +didQAX8kjSVUZEV2N72CACtQlFXY3L9XNfblzMPiEWARHV1jl6xT6pUZoG6uuwmPiL9 zX1O+vNZSTDnT3tyxdq5tdX2EsSMb1BKREnQpcbQxlD6aHYHguB93YUCoSavUTW8uOTz nJ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=qk4xiT+bTSUatRnCJl5OJ3SUdRqR+CwcXMQRpTyu8Tw=; b=0xMRLL1QCS7P8m2e8MjVx8T4OV8uxydQ0k02y3ldu2VYthN95Z+alX9Z9FPyC/+toi CBXme2dNG9rjEt9733tQoOylbz77qT4vPTdJ4djU7LlWv+u7ZFlLmer7Xu7n4vf1pgT+ c0hgSyDoQy6UDVJBHPA7TCA2NPjYTQk8n0hQSiv0CB4SwohsrNPazI8/UgBKpPrNk9j7 XgwrAs0fhrMyb3YAwXWSxjMgclgrL+wGZz+361t91/RlrNzfbLTmrHopNC8KAX54ota4 DathhmwUCg7juqfHW7JsdXVuUpaXr9FU7JNhNwrqlc3U7Z4tzOeu61B/mTiQRHpDhoUz V1BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=HqwSbkqc; dkim=pass header.i=@codeaurora.org header.s=default header.b=GIPgykqY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q19-v6si3422458pgl.77.2018.10.23.22.18.23; Tue, 23 Oct 2018 22:18:51 -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=@codeaurora.org header.s=default header.b=HqwSbkqc; dkim=pass header.i=@codeaurora.org header.s=default header.b=GIPgykqY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbeJXNoY (ORCPT + 99 others); Wed, 24 Oct 2018 09:44:24 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42364 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbeJXNoX (ORCPT ); Wed, 24 Oct 2018 09:44:23 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C2DDD60CF4; Wed, 24 Oct 2018 05:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1540358273; bh=k2XzIJ8xP7LHyzG7BFJ9Nngz3Uj+nENz4QOyNXYBC4g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HqwSbkqcGgOETyB94BE+UvH7XTsiwAQDHdwnCnNQCAYPNLlJ50tlctdmQE5hXWpGN 9sVErzMGTjhoBZdbB8w4ZujzUGmA64XTv1NFa73y2tUbu9yjhv57y2neBztaw6CDIJ moR2yJqDq2Zv8letfPfXrDBQtZeaXK1lZ0ZONcIo= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id BB54D606DC; Wed, 24 Oct 2018 05:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1540358272; bh=k2XzIJ8xP7LHyzG7BFJ9Nngz3Uj+nENz4QOyNXYBC4g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GIPgykqYp5YRXlgswVcCw6Zueyu4Jpl/p0IZtTUbGXfkE3mHT5ukzH2Vqh72lC8Hp /ZfHO28x3vWGlv2L6HCSsf8P9XtWTNq8Scxh3FsP9XwgxIEAEfJs3HKEXQk9hdoG3d dZWOjHWKEA/7sq5Efril+dkB6MQBvqblCfNovD7A= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 24 Oct 2018 10:47:52 +0530 From: Arun KS To: Kees Cook Cc: Konstantin Khlebnikov , Joe Perches , LKML , linux-mm , Minchan Kim , Michal Hocko , Arun Sudhilal , Greg Kroah-Hartman , Andrew Morton Subject: Re: [PATCH] mm: convert totalram_pages, totalhigh_pages and managed_pages to atomic. In-Reply-To: References: <1540229092-25207-1-git-send-email-arunks@codeaurora.org> <15247f54-53f3-83d4-6706-e9264b90ca7a@yandex-team.ru> Message-ID: <7a4fcbaee7efb71d2a3c6b403c090db4@codeaurora.org> X-Sender: arunks@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-10-24 01:34, Kees Cook wrote: > On Mon, Oct 22, 2018 at 10:11 PM, Konstantin Khlebnikov > wrote: >> On 23.10.2018 7:15, Joe Perches wrote:> On Mon, 2018-10-22 at 22:53 >> +0530, >> Arun KS wrote: >>>> Remove managed_page_count_lock spinlock and instead use atomic >>>> variables. >>> >>> Perhaps better to define and use macros for the accesses >>> instead of specific uses of atomic_long_ >>> >>> Something like: >>> >>> #define totalram_pages() (unsigned >>> long)atomic_long_read(&_totalram_pages) >> >> or proper static inline >> this code isn't so low level for breaking include dependencies with >> macro > > BTW, I noticed a few places in the patch that did multiple evaluations > of totalram_pages. It might be worth fixing those prior to doing the > conversion, too. e.g.: > > if (totalram_pages > something) > foobar(totalram_pages); <- value may have changed here > > should, instead, be: > > var = totalram_pages; <- get stable view of the value > if (var > something) > foobar(var); Thanks for reviewing. Point taken. > > -Kees > >> [dropped bloated cc - my server rejects this mess] > > Thank you -- I was struggling to figure out the best way to reply to > this. :) I'm sorry for the trouble caused. Sent the email using, git send-email --to-cmd="scripts/get_maintainer.pl -i" 0001-convert-totalram_pages-totalhigh_pages-and-managed_p.patch Is this not a recommended approach? Regards, Arun > > -Kees