Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6289303imm; Wed, 27 Jun 2018 05:30:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJIla8AEy1AoK+0nQNmw30Esqu4RWMA6Xc5ExNI6q/GXfD4Q7R19ixk3ztnH0EpK+dxKuya X-Received: by 2002:a63:735d:: with SMTP id d29-v6mr5016468pgn.156.1530102603779; Wed, 27 Jun 2018 05:30:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530102603; cv=none; d=google.com; s=arc-20160816; b=ji5+bXQEQk4TG0wSTxbcgQ/Pvb0uyPMjaBo8+8PpOV60cCDNZELvsNC6XJ1+bjUpow 3Bdl8yTFcBdhJrxJ7L/sAqqHRN36/MaFrC/YmUBQPaIV+TCRu9d5LXTFUbglcBeEWBwE YJHsllGhvUhiiy7ZfK6RYRnajaMAsHPrwvoypQpE6hEIaUn3y6Mp2hQt7IdttWuBGqw1 /wzK1s8YACh5QcXvMT+ykU3DMTPvSyjyJNC+xcHBXMfcju8cQ/yUWC8sl7VI841vb3z4 bjxHcsoakeDxIwHYWBACjSPgf8O/gwz2mC2OheZzmm9pgyr0tC6VI1x/7vsuo5Fu56D7 MYLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=EQmJnR9klH52lJPnvG3Q+3sJOGSn+RezVKulSbPoCDA=; b=wG/pkUqSidRHl2v/xb+PLNDYkikjlCRrudLzC/OWC4BIFcOFkGtaqKvNl3a4O+sX+G T10yQjUKCb8qFxPjS6jv444Qo+HPoD2Uym4gkMyxvAAPHOcDbMRpDKsvH4ZqB9Nx9e0R y6mO/twQTq6WvQg6tbAnENxhqbTQ4CxbQsU1DZqwp1mM5sjjcpgf2+6OXzM2A3TFW/9N miw/h+Vsp4NJMkbG2HefxJqgf6jd+S1JZ44jUCzCrfadsziXphB4Flnflh0ZniOMJ8ZZ ZP1FUfqKwuSsXpCHP7I1WGqf6U3olON8DKIII9v5r1wXB8YJP/OXtowU/A7AM99oVo7a j27A== ARC-Authentication-Results: i=1; mx.google.com; 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 e4-v6si3750817pfn.322.2018.06.27.05.29.47; Wed, 27 Jun 2018 05:30:03 -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; 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 S1753654AbeF0Kwi (ORCPT + 99 others); Wed, 27 Jun 2018 06:52:38 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:19938 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbeF0Kwh (ORCPT ); Wed, 27 Jun 2018 06:52:37 -0400 Received: from fsav304.sakura.ne.jp (fsav304.sakura.ne.jp [153.120.85.135]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w5RAqO8w008963; Wed, 27 Jun 2018 19:52:24 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav304.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav304.sakura.ne.jp); Wed, 27 Jun 2018 19:52:24 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav304.sakura.ne.jp) Received: from [192.168.1.8] (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w5RAqNCD008959 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Jun 2018 19:52:23 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH] mm,oom: Bring OOM notifier callbacks to outside of OOM killer. To: paulmck@linux.vnet.ibm.com Cc: Michal Hocko , David Rientjes , linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org References: <1529493638-6389-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> <20180621073142.GA10465@dhcp22.suse.cz> <2d8c3056-1bc2-9a32-d745-ab328fd587a1@i-love.sakura.ne.jp> <20180626170345.GA3593@linux.vnet.ibm.com> <20180626235014.GS3593@linux.vnet.ibm.com> From: Tetsuo Handa Message-ID: Date: Wed, 27 Jun 2018 19:52:23 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180626235014.GS3593@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/06/27 8:50, Paul E. McKenney wrote: > On Wed, Jun 27, 2018 at 05:10:48AM +0900, Tetsuo Handa wrote: >> As far as I can see, >> >> - atomic_set(&oom_callback_count, 1); >> + atomic_inc(&oom_callback_count); >> >> should be sufficient. > > I don't see how that helps. For example, suppose that two tasks > invoked rcu_oom_notify() at about the same time. Then they could > both see oom_callback_count equal to zero, both atomically increment > oom_callback_count, then both do the IPI invoking rcu_oom_notify_cpu() > on each online CPU. > > So far, so good. But rcu_oom_notify_cpu() enqueues a per-CPU RCU > callback, and enqueuing the same callback twice in quick succession > would fatally tangle RCU's callback lists. > > What am I missing here? > > Thanx, Paul You are pointing out that "number of rsp->call() is called" > "number of rcu_oom_callback() is called" can happen if concurrently called, aren't you? Then, you are not missing anything. You will need to use something equivalent to oom_lock even if you can convert rcu_oom_notify() to use shrinkers.