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.2 required=3.0 tests=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 2D2C4C433DF for ; Fri, 29 May 2020 16:04:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ECE3F20897 for ; Fri, 29 May 2020 16:04:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECE3F20897 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7CBAA8001A; Fri, 29 May 2020 12:04:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 77CBD80010; Fri, 29 May 2020 12:04:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6929C8001A; Fri, 29 May 2020 12:04:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 550D280010 for ; Fri, 29 May 2020 12:04:09 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0EAB02C68 for ; Fri, 29 May 2020 16:04:09 +0000 (UTC) X-FDA: 76870228218.20.rate15_24079c4be622d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id C507D180BFBAB for ; Fri, 29 May 2020 16:04:08 +0000 (UTC) X-HE-Tag: rate15_24079c4be622d X-Filterd-Recvd-Size: 3375 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Fri, 29 May 2020 16:04:07 +0000 (UTC) IronPort-SDR: pLnYycVelPyBxRaJzVM56IDxigZNkI+QR9Er+wqsTvIf9obrNeZeBqCUflcOsATbYJUav5JFOv BxSTx4HKcbGQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 May 2020 09:04:06 -0700 IronPort-SDR: K7WQ+p+AHl9FA+PZJ9fVRcfm6XJL6rO5WjNsbRs9qi1hgdkp3g/MMKoB9+negJVRdgZtW4mY5r HvJCZJldUXQw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,449,1583222400"; d="scan'208";a="469554686" Received: from shbuild999.sh.intel.com (HELO localhost) ([10.239.146.107]) by fmsmga005.fm.intel.com with ESMTP; 29 May 2020 09:04:02 -0700 Date: Sat, 30 May 2020 00:04:01 +0800 From: Feng Tang To: Andi Kleen Cc: Qian Cai , Michal Hocko , Andrew Morton , Johannes Weiner , Stephen Rothwell , Matthew Wilcox , Mel Gorman , Kees Cook , Luis Chamberlain , Iurii Zaikin , "Chen, Tim C" , "Hansen, Dave" , "Huang, Ying" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 0/3] make vm_committed_as_batch aware of vm overcommit policy Message-ID: <20200529160401.GJ93879@shbuild999.sh.intel.com> References: <20200521212726.GC6367@ovpn-112-192.phx2.redhat.com> <20200526181459.GD991@lca.pw> <20200527014647.GB93879@shbuild999.sh.intel.com> <20200527022539.GK991@lca.pw> <20200527104606.GE93879@shbuild999.sh.intel.com> <20200528141802.GB1810@lca.pw> <20200528151020.GF93879@shbuild999.sh.intel.com> <20200529154315.GI93879@shbuild999.sh.intel.com> <20200529155025.GC621576@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200529155025.GC621576@tassilo.jf.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Rspamd-Queue-Id: C507D180BFBAB X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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, May 29, 2020 at 08:50:25AM -0700, Andi Kleen wrote: > > > > ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); > > - if (ret == 0 && write) > > + if (ret == 0 && write) { > > + if (sysctl_overcommit_memory == OVERCOMMIT_NEVER) > > + schedule_on_each_cpu(sync_overcommit_as); > > The schedule is not atomic. > There's still a race window here over all the CPUs where the WARN_ON could > happen because you change the global first. The re-computing of batch number comes after this sync, so at this point the batch is still the bigger one, and won't trigger the warning. > Probably you would need another global that says "i'm currently changing > the mode" and then skip the WARN_ON in that window. Maybe a sequence lock. > > Seems all overkill to me. Better to kill the warning. Yes, the cost is high, schedule_on_each_cpu is labeled as "very slow" in the code comments. Thanks, Feng > > -Andi