Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp660260ybt; Mon, 6 Jul 2020 19:41:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybE71aqMsVfhqFgWUO10gCXlaCf4n4JA8IvsxNhG/RE/rFVIFbrbqokxBi/b11sg5nmW8R X-Received: by 2002:a17:906:c10f:: with SMTP id do15mr47785365ejc.249.1594089681905; Mon, 06 Jul 2020 19:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594089681; cv=none; d=google.com; s=arc-20160816; b=mb2Dym8JoVg7eyckI1mkrdK6H46W+uGUuqr2xWH3TmZJE/5WrGBZwuPuW/L9dIKQFY ORLSoLipaGq8iVnJ934a/7H0ENyQCTMHFo7oK52mW+G5xPR5e+lphLlRv6Z013NxPz6j BSa490sr2tMqc/FDz5tQ0w7e1+ybQ+IOk72emq2U9qEKs+ps9GkVs3IbL6hjZPjURqp+ 027/QnvK16z60kuezBsu6wytANnOypNwToSQx5pQrpkoc+fmxd/J9OU9lmVLsUjJlSbl 75CaiiAUG3c3OTQpVGE5tUqdTRjkk4oHm1CAnsSDpUOdouKvd1oXauyq0Ml4lEHUzzyh Qk5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=s6mWM/VJGniJ7UdMnN1rhBVA4jlpGZ0ILbZ3fKTaPrs=; b=YUqDQHYyzw2PBoEUFjchPbssl2BJZ+EbuRWLz1xJLzAmkzxOPdquNMk8dn2ynjKwaa qO9O+YG5vJYwhVHBRk+0l4GhnxxLYpMggLaxQrDrBDfssXJ3btBWyJnwdiDqKVswugPe LBZCklX2ShBdLiOyUhQklrsX7geUQshSpiz2wspSOWc0muIEmz/YjqMJkGiNG6X3m9xs 2Zw4+Agh+mkYeg589pTxtkbnSeQZH4TpZOq9vN+Zr7ZccxZbn130dy+m+Xi6cOI22u1m jfr/vHA3GXOP5sX5UOlZurV11zemwtlhjznYDXJsr/aL0dTS+aSNz08K2vZY8+GEKLI1 dmmw== 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 p8si13068364ejf.634.2020.07.06.19.40.57; Mon, 06 Jul 2020 19:41:21 -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 S1727886AbgGGCif (ORCPT + 99 others); Mon, 6 Jul 2020 22:38:35 -0400 Received: from mga11.intel.com ([192.55.52.93]:33432 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727827AbgGGCif (ORCPT ); Mon, 6 Jul 2020 22:38:35 -0400 IronPort-SDR: LERVPcaK2soudAsveVRK6jvRU8TJQou0PTlZgPapWBxOiyLeLGLasNpHQqIYkTM66/pdzojAyG 6IddldTcvYmg== X-IronPort-AV: E=McAfee;i="6000,8403,9674"; a="145630076" X-IronPort-AV: E=Sophos;i="5.75,321,1589266800"; d="scan'208";a="145630076" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2020 19:38:34 -0700 IronPort-SDR: 6qaw/Hnypxc/zSmBohiorkumC/YHiBQk2uyQGEdIfPxIC07OtwwSgEOdFBp03aWqds7HTPISdY 6caG3+NPKXrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,321,1589266800"; d="scan'208";a="482899731" Received: from shbuild999.sh.intel.com (HELO localhost) ([10.239.146.107]) by fmsmga006.fm.intel.com with ESMTP; 06 Jul 2020 19:38:30 -0700 Date: Tue, 7 Jul 2020 10:38:29 +0800 From: Feng Tang To: Andi Kleen Cc: 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 , tim.c.chen@intel.com, dave.hansen@intel.com, ying.huang@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, lkp@lists.01.org Subject: Re: [mm] 4e2c82a409: ltp.overcommit_memory01.fail Message-ID: <20200707023829.GA85993@shbuild999.sh.intel.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200706133434.GA3483883@tassilo.jf.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Feng > > > -Andi