From patchwork Tue Jul 20 07:42:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12387663 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 374E0C07E9B for ; Tue, 20 Jul 2021 07:43:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CDE4461165 for ; Tue, 20 Jul 2021 07:43:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDE4461165 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4F6D18D0001; Tue, 20 Jul 2021 03:43:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A6FE6B00A6; Tue, 20 Jul 2021 03:43:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 347AD8D0001; Tue, 20 Jul 2021 03:43:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id 0318F6B00A5 for ; Tue, 20 Jul 2021 03:43:18 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5ED6E181AC9B6 for ; Tue, 20 Jul 2021 07:43:17 +0000 (UTC) X-FDA: 78382175634.30.96C6C26 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf15.hostedemail.com (Postfix) with ESMTP id 958B8D000099 for ; Tue, 20 Jul 2021 07:43:16 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id d9-20020a17090ae289b0290172f971883bso1433110pjz.1 for ; Tue, 20 Jul 2021 00:43:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2RbqEZiSX0zvCsFSti0Yf2rZCpDWl6bafaeM5yD8kWg=; b=F5TizzOVyuUWukuBy50Pzl3IBoCLaNbweMj41op+sKYZz1UA1gk7ORcJSm6Tgb4O5b teQYFTNRS5ugXJMrD2QxvILumNQCRyb4BRchqVB5mD1lNTLxLDW3g3wTYj2nfB6r6ab3 fZ42rDMP42/nvHHnIib9dwgSoiSRGD/Wf6NFcSvh1h+iSx+zkQWnwm/dVZXrjXV8G7kG iv/ceUrEzq4frV36qm61WUPCGPxj7Z7Jj1iX0lMvP+H+XDLrI41PFp92dspI1B+BO1Ci b8U5B64i5en12UNolDEKlAC3BpMqQ4ksOqxW4BbOkpPFAwzEi0vkGNIO/5mYE+9pWKDH 9sMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2RbqEZiSX0zvCsFSti0Yf2rZCpDWl6bafaeM5yD8kWg=; b=B08VZCAKE9mx7rUyIMfs7pj5VXTkGszigIp9SxpK7Ok9RidD0/G2dNwQduc6KSdyxs rUD9ON7OQvg/4+8vXU7RwRiGbstdX1z+nWzlTDY1+8xDGVFAkNRz4kvLaQMtB1Csb+Sp 21keuPV3a2KbfRE/JRuaWVwaq7wGIJwOGN/cIedlRk/ZQwH6doeydTfuuqSz5YibGyfb LKIo3cN/RyExW26ulMfBCBk8eClWMQ+p21S7KmF7w3F0eWmZ+xqeAVBUl/vT+uxptcJZ 1K1udkdLcvFI0toXz6FuLqu4vyCJm3LhWBtHqt+Yqy9HYekLA7MJdDPuz1IlGPhnkhN0 ykCA== X-Gm-Message-State: AOAM5309RYTfmCkXToiH+HnJsUSYD6Pw5MZlf3kr4JIqxMZAC4V6MM+h qLHJqabfBdZPdEYB34oZSQPdGg== X-Google-Smtp-Source: ABdhPJyqls0EZ62wnwCkV7V/qwtCLnrwr6TDsvBPWB0tyUZZ1kOvpthnLenpcx9ICAOtryy6saU1/A== X-Received: by 2002:a17:90a:62ca:: with SMTP id k10mr27871740pjs.133.1626766995375; Tue, 20 Jul 2021 00:43:15 -0700 (PDT) Received: from localhost.localdomain ([61.120.150.70]) by smtp.gmail.com with ESMTPSA id c2sm24214505pgh.82.2021.07.20.00.43.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jul 2021 00:43:14 -0700 (PDT) From: Muchun Song To: akpm@linux-foundation.org, mgorman@techsingularity.net, shy828301@gmail.com, cuibixuan@huawei.com, vbabka@suse.cz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH] mm: mmap_lock: fix disabling preemption directly Date: Tue, 20 Jul 2021 15:42:28 +0800 Message-Id: <20210720074228.76342-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=F5TizzOV; spf=pass (imf15.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 958B8D000099 X-Stat-Signature: d61iwms74bgztmrfnpiynajowhauotc9 X-HE-Tag: 1626766996-362667 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: The commit 832b50725373 ("mm: mmap_lock: use local locks instead of disabling preemption") fix a bug by using local locks. But commit d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING configurations") changes those lines to original version. I guess it is introduced by the conflicts fixing on merging. Fixes: d01079f3d0c0 ("mm/mmap_lock: remove dead code for !CONFIG_TRACING configurations") Signed-off-by: Muchun Song Acked-by: Mel Gorman Reviewed-by: Yang Shi Reviewed-by: Pankaj Gupta --- mm/mmap_lock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c index f5852a058ce0..1854850b4b89 100644 --- a/mm/mmap_lock.c +++ b/mm/mmap_lock.c @@ -156,14 +156,14 @@ static inline void put_memcg_path_buf(void) #define TRACE_MMAP_LOCK_EVENT(type, mm, ...) \ do { \ const char *memcg_path; \ - preempt_disable(); \ + local_lock(&memcg_paths.lock); \ memcg_path = get_mm_memcg_path(mm); \ trace_mmap_lock_##type(mm, \ memcg_path != NULL ? memcg_path : "", \ ##__VA_ARGS__); \ if (likely(memcg_path != NULL)) \ put_memcg_path_buf(); \ - preempt_enable(); \ + local_unlock(&memcg_paths.lock); \ } while (0) #else /* !CONFIG_MEMCG */