Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp701315ybt; Mon, 6 Jul 2020 21:00:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylryCFyLxNbP2ZxTQ4gOQgQdjpDdZmOm2Erb3BZ8RKBrmNdVm95qHD2v34oU0I74f0/gU8 X-Received: by 2002:a17:906:4447:: with SMTP id i7mr36534342ejp.191.1594094456243; Mon, 06 Jul 2020 21:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594094456; cv=none; d=google.com; s=arc-20160816; b=gqV/wTthe7RQbb8KM4rNY+uIFdI7eAh1a+Jwd47J7MwePkSjzHzQJ1A/y2GHHZsiWY aMaeRR478DXuauPLHZugV7Cno9HSKb2wyDoe3P1A9pszxzTdW6vSa6yit10EHZ82o7cQ i8zqfqPdfGOgn+SVEpB7dfV7pbnG6TD3StcIplrMC5DREkvxu8lTWgSH+pWv1ifcw68i QOgOCHKxF8LntSh023+n3JIAdH9jc7ON6p02gFAl0OR4kgF4c4d1zJPRYuCA4v6YqLuX mdtRxf+V0uOxeVpLM9QffLSzLg755Krm0H7k3H08D4EQOMdTV3+ZV7TSQ9IpT6teHTEa 2xJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=AQdy1c83lL5g5X/zzjmzGQoS5AP1JvkVrrKKBfxN13E=; b=dxxIItcXn6NS+yX7w4fSm5ZnXKU3t2T8Iz1F6CjXGNFBFb71jfvbeaT8d18P9XoC4e tt8bahwFwKBx4KChM340NynJlg18QuT9hvQ1bCe2pa/tlVTkFocwtRNiMIBVnL1FxBVB oiM4WdMgEr2d4NNd0yr+wX6dLEvl9EUv7kF0ag7y4gdPdAjFJ56rRWjSLk9ZGwXIBncY tLXo+R5ObmZryNU93nAsPqdmxTnuvrhM6qa1Nkb6LsS5iKHhgiuOJy4YFx4E25HIEkzZ iXHl24EdvCImgoQvw7bDCnn2HCOe/N6m/r1RlXMQsrNxSmFDuTA55RP/pddUh/DseDAa AFEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si14539284edv.60.2020.07.06.21.00.31; Mon, 06 Jul 2020 21:00:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725974AbgGGEAP (ORCPT + 99 others); Tue, 7 Jul 2020 00:00:15 -0400 Received: from mga01.intel.com ([192.55.52.88]:35696 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbgGGEAP (ORCPT ); Tue, 7 Jul 2020 00:00:15 -0400 IronPort-SDR: EL5K891okWa3Zw42xw/y3xJysEgvgVn8UL2B/TjGf/YfaVWHEbaPxMGGfq4gMbI/GhY5pU5wNZ cnASqNjhwTcw== X-IronPort-AV: E=McAfee;i="6000,8403,9674"; a="165608383" X-IronPort-AV: E=Sophos;i="5.75,321,1589266800"; d="scan'208";a="165608383" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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