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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4EB3C433F5 for ; Tue, 10 May 2022 00:28:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15B6C6B0072; Mon, 9 May 2022 20:28:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 109486B0073; Mon, 9 May 2022 20:28:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEC0D6B0074; Mon, 9 May 2022 20:28:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DFAC96B0072 for ; Mon, 9 May 2022 20:28:14 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id B5DBB121254 for ; Tue, 10 May 2022 00:28:14 +0000 (UTC) X-FDA: 79447946508.02.FF35231 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf28.hostedemail.com (Postfix) with ESMTP id 5899BC0093 for ; Tue, 10 May 2022 00:27:54 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 722561F9DC; Tue, 10 May 2022 00:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652142491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PiZ39t1FcyuFoYGrkGdy/soYmQRv3Xc5CdmMi56dLEA=; b=wowhvFsqZJFp5HqM0TC60InGTcohlMeI5YvtyE1HXsF4qemd8wDlatJaU77PTafhubwKdS t4MtpPICJCGp+zd0AexsxqaAWoEmNkExUBqSiN6uO18NvipPyljG29WIYeuyI4tT7Qpq4S 0+8okeBoQq2avUqRu7zKjNgo2f33ThM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652142491; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PiZ39t1FcyuFoYGrkGdy/soYmQRv3Xc5CdmMi56dLEA=; b=7HjE29DsroPJdg9vEIBReECFG4fsFxwk9JWqdDCwA4d9wJV4S8X/OfIBbxDTQN6HJtJU2Q fjZiraMgZLXOmIAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C1D9413A76; Tue, 10 May 2022 00:28:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id H8/XHpexeWKlZAAAMHmgww (envelope-from ); Tue, 10 May 2022 00:28:07 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "Miaohe Lin" Cc: akpm@linux-foundation.org, willy@infradead.org, vbabka@suse.cz, dhowells@redhat.com, apopple@nvidia.com, david@redhat.com, surenb@google.com, peterx@redhat.com, naoya.horiguchi@nec.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linmiaohe@huawei.com Subject: Re: [PATCH 09/15] mm/swap: avoid calling swp_swap_info when try to check SWP_STABLE_WRITES In-reply-to: <20220509131416.17553-10-linmiaohe@huawei.com> References: <20220509131416.17553-1-linmiaohe@huawei.com>, <20220509131416.17553-10-linmiaohe@huawei.com> Date: Tue, 10 May 2022 10:28:04 +1000 Message-id: <165214248406.14782.6536817483979050668@noble.neil.brown.name> X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 5899BC0093 Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=wowhvFsq; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7HjE29Ds; spf=pass (imf28.hostedemail.com: domain of neilb@suse.de designates 195.135.220.29 as permitted sender) smtp.mailfrom=neilb@suse.de; dmarc=pass (policy=none) header.from=suse.de X-Rspam-User: X-Stat-Signature: xwinn6a5194ma6ijd9ig8kdyp3px71ea X-HE-Tag: 1652142474-620319 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, 09 May 2022, Miaohe Lin wrote: > Use flags of si directly to check SWP_STABLE_WRITES to avoid possible > READ_ONCE and thus save some cpu cycles. > > Signed-off-by: Miaohe Lin > --- > mm/memory.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memory.c b/mm/memory.c > index 9c3e7e6ac202..89dd15504f3d 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3892,7 +3892,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) > */ > exclusive = true; > } else if (exclusive && PageWriteback(page) && > - (swp_swap_info(entry)->flags & SWP_STABLE_WRITES)) { > + (si->flags & SWP_STABLE_WRITES)) { Should this have a data_race() annotation. Other bit-tests of si->flags do because scan_swap_map_slots can update it asynchronously, but we know that won't matter in practice. Thanks, NeilBrown > /* > * This is tricky: not all swap backends support > * concurrent page modifications while under writeback. > -- > 2.23.0 > >