From patchwork Tue Sep 24 23:24:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11159783 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1AF2912 for ; Tue, 24 Sep 2019 23:25:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8928121655 for ; Tue, 24 Sep 2019 23:25:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GcB3+mac" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8928121655 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A20436B0008; Tue, 24 Sep 2019 19:25:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9D0586B000C; Tue, 24 Sep 2019 19:25:19 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8BEE76B000D; Tue, 24 Sep 2019 19:25:19 -0400 (EDT) X-Original-To: linux-mm@kvack.org 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 64A2F6B0008 for ; Tue, 24 Sep 2019 19:25:19 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id E1DB82DF0 for ; Tue, 24 Sep 2019 23:25:18 +0000 (UTC) X-FDA: 75971397516.10.fear44_4b705fa34054c X-Spam-Summary: 2,0,0,eabda8e5b535c91b,d41d8cd98f00b204,33awkxqykcey627piwowwotm.kwutqv25-uus3iks.wzo@flex--yuzhao.bounces.google.com,:akpm@linux-foundation.org:mhocko@suse.com:kirill.shutemov@linux.intel.com:peterz@infradead.org:mingo@redhat.com:acme@kernel.org:alexander.shishkin@linux.intel.com:jolsa@redhat.com:namhyung@kernel.org:vbabka@suse.cz:hughd@google.com:jglisse@redhat.com:aarcange@redhat.com:aneesh.kumar@linux.ibm.com:rientjes@google.com:willy@infradead.org:ldr709@gmail.com:rcampbell@nvidia.com:jgg@ziepe.ca:airlied@redhat.com:thellstrom@vmware.com:jrdr.linux@gmail.com:mgorman@suse.de:jack@suse.cz:mike.kravetz@oracle.com:ying.huang@intel.com:ziqian.lzq@antfin.com:osandov@fb.com:tglx@linutronix.de:vpillai@digitalocean.com:daniel.m.jordan@oracle.com:rppt@linux.ibm.com:joel@joelfernandes.org:mark.rutland@arm.com:alexander.h.duyck@linux.intel.com:pavel.tatashin@microsoft.com:david@redhat.com:jgross@suse.com:anthony.yznaga@oracle.com:hannes@cmpxchg.org:darrick.wong@oracl e.com:li X-HE-Tag: fear44_4b705fa34054c X-Filterd-Recvd-Size: 5143 Received: from mail-qt1-f201.google.com (mail-qt1-f201.google.com [209.85.160.201]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Sep 2019 23:25:18 +0000 (UTC) Received: by mail-qt1-f201.google.com with SMTP id r15so3923140qtn.12 for ; Tue, 24 Sep 2019 16:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=8TGliIBWPQiMc/dcK6U25tRYwGliMmayQocgS2bc3e4=; b=GcB3+maccc3yyJ68p6K6orlxKqatE32oUgshjiHKVZsaWKaPYUjICFK3v/zSYFr6jj 35J0LEAaUV1gahRSD3uui0BgHElrdBfxTtpBQxXFu7nO5RAzCMsztrcDrBogams0wBLN /JSK0q+AGwo2zFh+eZemw25WwBDqVQ2E0U9BgNQgbKSe/VJvUp3AFssYHLlXr2IWcU3P w7UxVFKW43AAZIWrhAKtL/HJDQaYza9VlYGq+Fy8TOP/oU75vBbs4BpHhai4QYbNXl9E 7E/F6h9+Y+3Tnt2l44lXRpFgq0POnIviT0Fy411wk//ApNDq4085CX6An4BQz+ubebij j1fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=8TGliIBWPQiMc/dcK6U25tRYwGliMmayQocgS2bc3e4=; b=cOToXzLuPHC/vWulGL0/VR84vEHtQPhKYy1CZhdrc8+39Nz1Q7nWxmRMF3Iv6gPk2R QI4/m7iqjZePdyr3bXBdpG7SWGYQSB+CQQizbiiaxlAcOr+b48AebfvAoghBQNFlXc+t dHR6yOv+OKT9vHH76cUgvJ0ROGQhSCuwMM4m8svRYbmlbecjQxl+Q1ebRSCbMDQ236Vw ksBjDvC51hvMfd5X2xRANGZdXvn930KmeQJEdvUa+Ru2xU2rN4kfdi8/4MEJ2kfD/8dO qwvje1Z5NG4czGmxQYvK+UFVbezSQvsolK70N8EeRRl1Z3/EfcreqAoiPBJxEtI5HfWL 9tiw== X-Gm-Message-State: APjAAAUvusBFv4VnVDVPiPAbOgwgybxubfxzFtOB/i3IeVLTGHMIStVK 22AMjVgo7TqYf+7gO6y8lkB23RjEQec= X-Google-Smtp-Source: APXvYqwqBI8fxarOPb9Kg9kSXeOK0+ZnCpMrgtm6xbNSOhZGZ6kttvBsIjy9TurHbnzhnJqkh7NowzV1lsk= X-Received: by 2002:a0c:c251:: with SMTP id w17mr4701768qvh.226.1569367517179; Tue, 24 Sep 2019 16:25:17 -0700 (PDT) Date: Tue, 24 Sep 2019 17:24:56 -0600 In-Reply-To: <20190914070518.112954-1-yuzhao@google.com> Message-Id: <20190924232459.214097-1-yuzhao@google.com> Mime-Version: 1.0 References: <20190914070518.112954-1-yuzhao@google.com> X-Mailer: git-send-email 2.23.0.351.gc4317032e6-goog Subject: [PATCH v3 1/4] mm: remove unnecessary smp_wmb() in collapse_huge_page() From: Yu Zhao To: Andrew Morton , Michal Hocko , "Kirill A . Shutemov" Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Vlastimil Babka , Hugh Dickins , " =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= " , Andrea Arcangeli , "Aneesh Kumar K . V" , David Rientjes , Matthew Wilcox , Lance Roy , Ralph Campbell , Jason Gunthorpe , Dave Airlie , Thomas Hellstrom , Souptick Joarder , Mel Gorman , Jan Kara , Mike Kravetz , Huang Ying , Aaron Lu , Omar Sandoval , Thomas Gleixner , Vineeth Remanan Pillai , Daniel Jordan , Mike Rapoport , Joel Fernandes , Mark Rutland , Alexander Duyck , Pavel Tatashin , David Hildenbrand , Juergen Gross , Anthony Yznaga , Johannes Weiner , "Darrick J . Wong" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yu Zhao 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: __SetPageUptodate() always has a built-in smp_wmb() to make sure user data copied to a new page appears before set_pmd_at(). Signed-off-by: Yu Zhao --- mm/khugepaged.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index ccede2425c3f..70ff98e1414d 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1067,13 +1067,6 @@ static void collapse_huge_page(struct mm_struct *mm, _pmd = mk_huge_pmd(new_page, vma->vm_page_prot); _pmd = maybe_pmd_mkwrite(pmd_mkdirty(_pmd), vma); - /* - * spin_lock() below is not the equivalent of smp_wmb(), so - * this is needed to avoid the copy_huge_page writes to become - * visible after the set_pmd_at() write. - */ - smp_wmb(); - spin_lock(pmd_ptl); BUG_ON(!pmd_none(*pmd)); page_add_new_anon_rmap(new_page, vma, address, true);