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=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 38B85C433E0 for ; Tue, 7 Jul 2020 04:00:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 06C412053B for ; Tue, 7 Jul 2020 04:00:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06C412053B 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 5F10D6B0026; Tue, 7 Jul 2020 00:00:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A2156B0027; Tue, 7 Jul 2020 00:00:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DDA66B0028; Tue, 7 Jul 2020 00:00:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id 384596B0026 for ; Tue, 7 Jul 2020 00:00:19 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C50E11EE6 for ; Tue, 7 Jul 2020 04:00:18 +0000 (UTC) X-FDA: 77009927316.04.wish10_250738c26eb1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id A00508005194 for ; Tue, 7 Jul 2020 04:00:18 +0000 (UTC) X-HE-Tag: wish10_250738c26eb1 X-Filterd-Recvd-Size: 3992 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 04:00:16 +0000 (UTC) IronPort-SDR: oPYVjGKbK5FEz5yWmKWHm1iZoIadRzGkGGJMs4G6ixfrbgRDkDlIpHdqkkNvQqscMF9YyH95pU hWlGi24OAs/Q== X-IronPort-AV: E=McAfee;i="6000,8403,9674"; a="127128462" X-IronPort-AV: E=Sophos;i="5.75,321,1589266800"; d="scan'208";a="127128462" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2020 21:00:15 -0700 IronPort-SDR: Bo/InfGLqN0TlWhfWFo0SsTUfzuJI0eiYj8ODI9GklMTnb4KTuc+eYwfcioPM0FDskXl1dzeXD qeheRpxQJIDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,321,1589266800"; d="scan'208";a="266711899" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.23]) by fmsmga007.fm.intel.com with ESMTP; 06 Jul 2020 21:00:10 -0700 From: "Huang\, Ying" To: Feng Tang Cc: Andi Kleen , Qian Cai , Andrew Morton , "Dennis Zhou" , Tejun Heo , Christoph Lameter , kernel test robot , Michal Hocko , Johannes Weiner , Matthew Wilcox , Mel Gorman , Kees Cook , Luis Chamberlain , Iurii Zaikin , , , , , Subject: Re: [mm] 4e2c82a409: ltp.overcommit_memory01.fail References: <20200705044454.GA90533@shbuild999.sh.intel.com> <20200705125854.GA66252@shbuild999.sh.intel.com> <20200705155232.GA608@lca.pw> <20200706014313.GB66252@shbuild999.sh.intel.com> <20200706023614.GA1231@lca.pw> <20200706132443.GA34488@shbuild999.sh.intel.com> <20200706133434.GA3483883@tassilo.jf.intel.com> <20200707023829.GA85993@shbuild999.sh.intel.com> Date: Tue, 07 Jul 2020 12:00:09 +0800 In-Reply-To: <20200707023829.GA85993@shbuild999.sh.intel.com> (Feng Tang's message of "Tue, 7 Jul 2020 10:38:29 +0800") Message-ID: <87zh8c7z5i.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Queue-Id: A00508005194 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: Feng Tang writes: > On Mon, Jul 06, 2020 at 06:34:34AM -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_on_each_cpu is not atomic, so the problem could still happen >> in that window. >> >> I think it may be ok if it eventually resolves, but certainly needs >> a comment explaining it. Can you do some stress testing toggling the >> policy all the time on different CPUs and running the test on >> other CPUs and see if the test fails? > > For the raw test case reported by 0day, this patch passed in 200 times > run. And I will read the ltp code and try stress testing it as you > suggested. > > >> The other alternative would be to define some intermediate state >> for the sysctl variable and only switch to never once the schedule_on_each_cpu >> returned. But that's more complexity. > > One thought I had is to put this schedule_on_each_cpu() before > the proc_dointvec_minmax() to do the sync before sysctl_overcommit_memory > is really changed. But the window still exists, as the batch is > still the larger one. Can we change the batch firstly, then sync the global counter, finally change the overcommit policy? Best Regards, Huang, Ying