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.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 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 BCBE4C352A9 for ; Thu, 26 Sep 2019 13:02:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7809B222BE for ; Thu, 26 Sep 2019 13:02:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="iKB8iMMp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7809B222BE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lca.pw Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 223A68E000A; Thu, 26 Sep 2019 09:02:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1ADF58E0001; Thu, 26 Sep 2019 09:02:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09C2B8E000A; Thu, 26 Sep 2019 09:02:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id D68358E0001 for ; Thu, 26 Sep 2019 09:02:31 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 6FB261F86A for ; Thu, 26 Sep 2019 13:02:31 +0000 (UTC) X-FDA: 75977085702.07.low78_8a514f189e310 X-HE-Tag: low78_8a514f189e310 X-Filterd-Recvd-Size: 5509 Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Sep 2019 13:02:30 +0000 (UTC) Received: by mail-qt1-f196.google.com with SMTP id c21so2669438qtj.12 for ; Thu, 26 Sep 2019 06:02:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=Dtv5V4xuAX2qubER6XZTSCZ8MR1PT0yb6P2Q568+EKA=; b=iKB8iMMpiJyB+hlUoNXrd6ToWzpKLma9R4tAfHJh0IkC/bXzbeYt5q6OBSZe3i26i3 xd+cxHbW2vayKi6d9RrulvbyR95zphMHepSdsLyTif+yj6AfLQwL8FC23oSTXvlTp6wE oxodMwRJ7n+JfUy3B6JLXD+t4YwX/ZbaSh1CE7UgzIUB+WRH4S5zdoUEOYSxNl7+ncj3 m5LXWhHugHAa/bWTu7uqeP7w4GQe74SsLIoVP4rbAMC4hOMH2BCJwgelF7Lx0meJ45XL +RfsgcxvGt33v1zO3xXY79HBeL5MDGMtd4QeBhMShoVWnEgH/9P3fnFTPYWGe4OrLwpM v3CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dtv5V4xuAX2qubER6XZTSCZ8MR1PT0yb6P2Q568+EKA=; b=YMnTzPPibNxAqKnsPHKuqNUWIvqzCpRka3/eYecUYre2bJkmIFyctLh+Xq+iTCYsL4 c/lDlPaoYrOO3Xcpjo8jkEfuWhsb/ZCkKQJV3YYZEIgcEuzTvJLLQV0q8ILw9Ihw+sWP y2Cw3WFLokViAvKSWV895XDE2l2tHKo+dgT5aGUDnQtZb0RkP9AFcJyT+zizwjJTgL4K BfVn/TTj+/RQhlmPYhDn5Qfeq85N1Ha04/wGKyzVtkw5qKZuYMNmHb59QL4XHUEzCF3W XGnoTBKJ6KF0x2tZOccmKAFduvl24Z/wTCkbJvTAZkE6B8fzSFw339xbW6iRWDOPC5M8 N1WA== X-Gm-Message-State: APjAAAVbLGhO17wbsygjUB4aMcsILj9ffDrq0DiovAg9joDklqV625jP R+cJixp8L2n+v+xnZ6Kk+RdjwA== X-Google-Smtp-Source: APXvYqxtQJ9FJHaGp6hMrrPUUV4eHNQC2OttRZ8hWWRAnvvoWTeWkWAxAzFN1A4nP65N541R1qH5LA== X-Received: by 2002:ac8:1cf:: with SMTP id b15mr3685424qtg.56.1569502949510; Thu, 26 Sep 2019 06:02:29 -0700 (PDT) Received: from dhcp-41-57.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id u11sm940642qtg.11.2019.09.26.06.02.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Sep 2019 06:02:28 -0700 (PDT) Message-ID: <1569502946.5576.237.camel@lca.pw> Subject: Re: [PATCH v1] mm/memory_hotplug: Don't take the cpu_hotplug_lock From: Qian Cai To: Michal Hocko Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Oscar Salvador , Pavel Tatashin , Dan Williams , Thomas Gleixner Date: Thu, 26 Sep 2019 09:02:26 -0400 In-Reply-To: <20190926115258.GH20255@dhcp22.suse.cz> References: <20190926072645.GA20255@dhcp22.suse.cz> <20190926115258.GH20255@dhcp22.suse.cz> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 (3.22.6-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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 Thu, 2019-09-26 at 13:52 +0200, Michal Hocko wrote: > On Thu 26-09-19 07:19:27, Qian Cai wrote: > > > > > > > On Sep 26, 2019, at 3:26 AM, Michal Hocko wrote: > > > > > > OK, this is using for_each_online_cpu but why is this a problem? Have > > > you checked what the code actually does? Let's say that online_pages is > > > racing with cpu hotplug. A new CPU appears/disappears from the online > > > mask while we are iterating it, right? Let's start with cpu offlining > > > case. We have two choices, either the cpu is still visible and we update > > > its local node configuration even though it will disappear shortly which > > > is ok because we are not touching any data that disappears (it's all > > > per-cpu). Case when the cpu is no longer there is not really > > > interesting. For the online case we might miss a cpu but that should be > > > tolerateable because that is not any different from triggering the > > > online independently of the memory hotplug. So there has to be a hook > > > from that code path as well. If there is none then this is buggy > > > irrespective of the locking. > > > > > > Makes sense? > > > > This sounds to me requires lots of audits and testing. Also, someone who is more > > familiar with CPU hotplug should review this patch. > > Thomas is on the CC list. > > > Personally, I am no fun of > > operating on an incorrect CPU mask to begin with, things could go wrong really > > quickly... > > Do you have any specific arguments? Just think of cpu and memory > hotplugs being independent operations. There is nothing really > inherently binding them together. If the cpu_online_mask really needs a > special treatment here then I would like to hear about that. Handwaving > doesn't really helps us. That is why I said it needs CPU hotplug experts to confirm that things including if CPU masks are tolerate to this kind of "abuse", or in-depth analysis of each calls sites that access CPU masks in both online_pages() and offline_pages() as well as ideally, more testing data in those areas. However, many kernel commits were merged with the expectations that people are going to deal with the aftermath, so I am not going to insist.