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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 25F62C433E0 for ; Thu, 18 Mar 2021 14:01:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A303B64F2A for ; Thu, 18 Mar 2021 14:01:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A303B64F2A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine 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 214FC6B0070; Thu, 18 Mar 2021 10:01:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EC566B0071; Thu, 18 Mar 2021 10:01:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08D646B0073; Thu, 18 Mar 2021 10:01:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id E1E796B0070 for ; Thu, 18 Mar 2021 10:01:37 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4B8B51816BB69 for ; Thu, 18 Mar 2021 14:01:37 +0000 (UTC) X-FDA: 77933157834.37.50B562F Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf30.hostedemail.com (Postfix) with ESMTP id C9904E000311 for ; Thu, 18 Mar 2021 14:01:34 +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=1616076086; h=from:from:reply-to: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=CJKjKFzH2Oz9V1KExzh/D5bnwo5wq9sGnNFQSvBiHoE=; b=Wom5vnku1jvAJyVaLvzB9o9HTjhTb0xA6SLbfWE2afD0RUi+h+TnBjUTC5EnU4pVJRzIO6 RV9e+V0KTVuVkex7bcTAqI5M4I6MA2kENPgPkcOVuPxUUbArdzpB598lQc/wGqF6T6q9ht IeQVdK3N+hVid6CnPSTubid4TFs34yw= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6390FAB8C; Thu, 18 Mar 2021 14:01:26 +0000 (UTC) Date: Thu, 18 Mar 2021 15:01:25 +0100 From: Michal Hocko To: Shakeel Butt Cc: Hugh Dickins , Johannes Weiner , Roman Gushchin , Andrew Morton , Minchan Kim , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Heiko Carstens Subject: Re: [PATCH] memcg: set page->private before calling swap_readpage Message-ID: References: <20210318015959.2986837-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210318015959.2986837-1-shakeelb@google.com> X-Stat-Signature: y1p7gz7834tceenxe1tmdbhf6t97yu13 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: C9904E000311 Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf30; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616076094-276525 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 17-03-21 18:59:59, Shakeel Butt wrote: > The function swap_readpage() (and other functions it call) extracts swap > entry from page->private. However for SWP_SYNCHRONOUS_IO, the kernel > skips the swapcache and thus we need to manually set the page->private > with the swap entry before calling swap_readpage(). One thing that is not really clear to me is whether/why this is only needed with your patch. Can you expand a bit on that please? Maybe I am just missing something obvious but I just do not see any connection. > Signed-off-by: Shakeel Butt > Reported-by: Heiko Carstens > --- > > Andrew, please squash this into "memcg: charge before adding to > swapcache on swapin" patch. > > mm/memory.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/mm/memory.c b/mm/memory.c > index aefd158ae1ea..b6f3410b5902 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3324,7 +3324,11 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) > workingset_refault(page, shadow); > > lru_cache_add(page); > + > + /* To provide entry to swap_readpage() */ > + set_page_private(page, entry.val); > swap_readpage(page, true); > + set_page_private(page, 0); > } > } else { > page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE, > -- > 2.31.0.rc2.261.g7f71774620-goog > -- Michal Hocko SUSE Labs