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=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 10E67C43457 for ; Mon, 19 Oct 2020 12:31:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7219A22365 for ; Mon, 19 Oct 2020 12:31:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="aG8xuILs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7219A22365 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 56C556B005D; Mon, 19 Oct 2020 08:31:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51B746B0062; Mon, 19 Oct 2020 08:31:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40B2A6B0068; Mon, 19 Oct 2020 08:31:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0093.hostedemail.com [216.40.44.93]) by kanga.kvack.org (Postfix) with ESMTP id 10C216B005D for ; Mon, 19 Oct 2020 08:31:41 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7A4713629 for ; Mon, 19 Oct 2020 12:31:40 +0000 (UTC) X-FDA: 77388611160.08.push79_100685627237 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 548471819E76C for ; Mon, 19 Oct 2020 12:31:40 +0000 (UTC) X-HE-Tag: push79_100685627237 X-Filterd-Recvd-Size: 3434 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Mon, 19 Oct 2020 12:31:39 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603110698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yxT0LHLLj1NGW+HpQy+scieHUSz/lm8V9lIyuOUC7lA=; b=aG8xuILsDAF6emeajF/1CEWajNDjFnwH8YL/KbUAoULzRQcPupZ29Ch4RDk3n5Nt+ciyhN pZq+yghqi/nCPfIiikEFNtIbSNe1f6HCeXuUGCSGKFqscByNK6pFURzWif9kZiinlT2LaW +yv8zkaRTrFBaSzgEl6IwvnniCb1rLU= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 71E9CB1DD; Mon, 19 Oct 2020 12:31:38 +0000 (UTC) Date: Mon, 19 Oct 2020 14:31:37 +0200 From: Michal Hocko To: Muchun Song Cc: akpm@linux-foundation.org, sfr@canb.auug.org.au, osalvador@suse.de, alexander.h.duyck@linux.intel.com, yang.shi@linux.alibaba.com, david@redhat.com, hannes@cmpxchg.org, hughd@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm/memory.c: Introduce non-atomic __{Set,Clear}PageSwapCache Message-ID: <20201019123137.GG27114@dhcp22.suse.cz> References: <20201019101520.12283-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201019101520.12283-1-songmuchun@bytedance.com> 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 Mon 19-10-20 18:15:20, Muchun Song wrote: > For the exclusive reference page, the non-atomic operations is enough, > so replace them to non-atomic operations. I do expect you do not see any difference in runtime and this is mostly driven by the code reading, right? Being explicit about this in the code would be preferred. No objection to the change. > Signed-off-by: Muchun Song With an improved changelog Acked-by: Michal Hocko > --- > include/linux/page-flags.h | 2 ++ > mm/memory.c | 4 ++-- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h > index fbbb841a9346..ec039dde5e4b 100644 > --- a/include/linux/page-flags.h > +++ b/include/linux/page-flags.h > @@ -401,6 +401,8 @@ static __always_inline int PageSwapCache(struct page *page) > } > SETPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL) > CLEARPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL) > +__SETPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL) > +__CLEARPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL) > #else > PAGEFLAG_FALSE(SwapCache) > #endif > diff --git a/mm/memory.c b/mm/memory.c > index 2d267ef6621a..02dd62da26e0 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3128,10 +3128,10 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) > set_page_private(page, entry.val); > > /* Tell memcg to use swap ownership records */ > - SetPageSwapCache(page); > + __SetPageSwapCache(page); > err = mem_cgroup_charge(page, vma->vm_mm, > GFP_KERNEL); > - ClearPageSwapCache(page); > + __ClearPageSwapCache(page); > if (err) { > ret = VM_FAULT_OOM; > goto out_page; > -- > 2.20.1 > -- Michal Hocko SUSE Labs