Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3618287ybi; Mon, 29 Jul 2019 09:34:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtnmntjpGEYuK/nNWLFGI/JKKuZdjaLk/0T/xkHqSmwKwKYLxiwo1ZnMaJy2ZEMELfXxX+ X-Received: by 2002:a63:553:: with SMTP id 80mr107979965pgf.280.1564418063652; Mon, 29 Jul 2019 09:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564418063; cv=none; d=google.com; s=arc-20160816; b=h8QwGPenvv+CKpL1Q8OLriX+rhx21XFNFFiko66iOTbxOJnGx1eqcIk0ulIN3xWxX5 OdxnxsRvcHzZC5bMo9ySaw3VAXbgmq/lQVfLu8gIw/8bWY0gLlGfKfcQomxYK03whK6u gW9YSyJNgWWZsM/o8U2osfYadBR3rcRDYKr8NcE7tIKaKM4wRfbLokaUBafkFDyZGIsr PhS5vTlDSM/YijJPFLcWP0KNhD/eFOvwKCbwVRMRSUPCx3LqQl8VNzasZ2EvU0Mx677f igCs1B3wppSqkJ2iKKvGGGHgz0cqGW/i/rcmucEU+mIO2VsRL7/OR9uOnriLJ5xhSdRf YD+w== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=loioVCoTKsMVvmmTkaQp/BDJfjR6FcYDuTi4m90+06Q=; b=y4IcOOhsRyUczdayFy0OqDnu1JYygfyEkxQfEKIp36c+PYXl37+ho9uTk8DTqOwMey BiROkl4iccaTtFkRKN7c2zPu6QuNG3u0i8/fMSucYzkTcCuneW68pRq5TnY2DhO6WTA2 Jd3Q9ErjexanV1WxCXZ2N74Ywq4A4ETCpcvb7nsr5VdtIK5uv1mFBVsyyr3ZYacEL/7y px0q8dznC8CiCMxQzao7cwXkNXnI9ZTxexwQeSFp1ybfzZusNQGssLbmj2PxkBTZ3+sJ 4nIH/GZGrWq3M/lMcEwy1cckAnVCf+KlOmZ3iguECdkSIYWvOMXsP7w7LaAr885uoj3c LxKw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=monom.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si26672301pff.178.2019.07.29.09.34.08; Mon, 29 Jul 2019 09:34:23 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=monom.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388126AbfG2Pkz (ORCPT + 99 others); Mon, 29 Jul 2019 11:40:55 -0400 Received: from mail.monom.org ([188.138.9.77]:49936 "EHLO mail.monom.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388096AbfG2Pky (ORCPT ); Mon, 29 Jul 2019 11:40:54 -0400 Received: from mail.monom.org (localhost [127.0.0.1]) by filter.mynetwork.local (Postfix) with ESMTP id 8A657500767; Mon, 29 Jul 2019 17:40:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.monom.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (b9168f76.cgn.dg-w.de [185.22.143.118]) by mail.monom.org (Postfix) with ESMTPSA id 56685500959; Mon, 29 Jul 2019 17:40:51 +0200 (CEST) From: Daniel Wagner To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Greg KH , Jon Hunter Subject: [PATCH 4.4 1/2] vmstat: Remove BUG_ON from vmstat_update Date: Mon, 29 Jul 2019 17:40:45 +0200 Message-Id: <20190729154046.8824-2-wagi@monom.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190729154046.8824-1-wagi@monom.org> References: <20190729154046.8824-1-wagi@monom.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Lameter [ Upstream commit 587198ba5206cdf0d30855f7361af950a4172cd6 ] If we detect that there is nothing to do just set the flag and do not check if it was already set before. Races really do not matter. If the flag is set by any code then the shepherd will start dealing with the situation and reenable the vmstat workers when necessary again. Since commit 0eb77e988032 ("vmstat: make vmstat_updater deferrable again and shut down on idle") quiet_vmstat might update cpu_stat_off and mark a particular cpu to be handled by vmstat_shepherd. This might trigger a VM_BUG_ON in vmstat_update because the work item might have been sleeping during the idle period and see the cpu_stat_off updated after the wake up. The VM_BUG_ON is therefore misleading and no more appropriate. Moreover it doesn't really suite any protection from real bugs because vmstat_shepherd will simply reschedule the vmstat_work anytime it sees a particular cpu set or vmstat_update would do the same from the worker context directly. Even when the two would race the result wouldn't be incorrect as the counters update is fully idempotent. Reported-by: Sasha Levin Signed-off-by: Christoph Lameter Acked-by: Michal Hocko Cc: Johannes Weiner Cc: Tetsuo Handa Cc: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Daniel Wagner --- mm/vmstat.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index dd0a13013cb4..233045057a30 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1407,17 +1407,7 @@ static void vmstat_update(struct work_struct *w) * Defer the checking for differentials to the * shepherd thread on a different processor. */ - int r; - /* - * Shepherd work thread does not race since it never - * changes the bit if its zero but the cpu - * online / off line code may race if - * worker threads are still allowed during - * shutdown / startup. - */ - r = cpumask_test_and_set_cpu(smp_processor_id(), - cpu_stat_off); - VM_BUG_ON(r); + cpumask_set_cpu(smp_processor_id(), cpu_stat_off); } } -- 2.20.1