Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp556584pxf; Thu, 18 Mar 2021 07:03:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaXTUfGsprAJiNi8nm+7lAXT4MqGUA0BNSZ/efdVk0M82ev5RQFmjB/o9TkwkNOBhl40U1 X-Received: by 2002:aa7:c98f:: with SMTP id c15mr3925902edt.231.1616076202851; Thu, 18 Mar 2021 07:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616076202; cv=none; d=google.com; s=arc-20160816; b=FircUNlJ5zH6SQ70CAPwPnkL+vPqft0IW6bEr0Z+rYlZrx8dY7/XF0vIzi8U3Amn3m Xg828mVf3Tilt8RSQdbuVSrEnYh98J/Ii7NRX6yM1VkXdo+zJg3oc8qL5z54d9j/wiv2 xTeVb8VvFMCwTBAx2jUAHjd4RYCJs4AUXDFiwddnqbijNfOCPrmn20ScP/MBqgRrfvXI FDw/KqkDyubmpSGoqtGHZhhCu/2hSJLX+BRTbtPCXJQquSSS026OIYMCagA5CtcQuppf VySPM/rjP5rB6eJIPYsiEhDEjvTXK1FE8vBRlNhBlTgY9Sl2VXD1eEhoG2dvs6OSWwpU 1/lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CJKjKFzH2Oz9V1KExzh/D5bnwo5wq9sGnNFQSvBiHoE=; b=EjsqwE+Cv726jQopFUY06xYeft75NEAeEuo4kpTT/FcZmstyB74Z7bvzuPziuRfNft ooBeGzY0fnpk47I0uf9QcqDbZkeQzKTE1q30p4iMEDAYwxlLezzGL/JsaKZ8ej/Vi1CS O8WYCRsn0VpTjONO5Sg6j86b9VsNPRJ6B479padGA3ELy/ZddxY7Sdz1fvk3Pc9Qg/7s 54foc8Ybr7f5qD0d/UvUdWDWN2/86CInFNsAlkJB4HizTD3sFTZkFqukDB7P72j3xdHN /TxPn7w1oZa5GWPUPEr7ISo/941VtWL4oSHKy+CRrCbgZRspyphE8SNhyV/nxjPmioV9 ybLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Wom5vnku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm20si1615465edb.120.2021.03.18.07.02.53; Thu, 18 Mar 2021 07:03:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Wom5vnku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbhCROBy (ORCPT + 99 others); Thu, 18 Mar 2021 10:01:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:52880 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbhCROB2 (ORCPT ); Thu, 18 Mar 2021 10:01:28 -0400 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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