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=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 13977C433E0 for ; Thu, 18 Mar 2021 01:31:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7604164F24 for ; Thu, 18 Mar 2021 01:31:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7604164F24 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B069B6B0070; Wed, 17 Mar 2021 21:31:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8D726B0071; Wed, 17 Mar 2021 21:31:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B9A76B0072; Wed, 17 Mar 2021 21:31:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0154.hostedemail.com [216.40.44.154]) by kanga.kvack.org (Postfix) with ESMTP id 69AE36B0070 for ; Wed, 17 Mar 2021 21:31:01 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1BDAA363C for ; Thu, 18 Mar 2021 01:31:01 +0000 (UTC) X-FDA: 77931266280.19.56044A9 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf12.hostedemail.com (Postfix) with ESMTP id 85D74132 for ; Thu, 18 Mar 2021 01:30:58 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id kr3-20020a17090b4903b02900c096fc01deso2262772pjb.4 for ; Wed, 17 Mar 2021 18:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=O+gSC6NwZyh8GlX0/8rGOK7WJ2Eoitq1cIB93Dk3fiI=; b=Mr2SQcUowt+olEIVnlHcI56EdJLfM6579naHTxVZiFoeSoKX8HlRpLCVJQySmk7P70 VJ0CCZzUYn1exrxgpYTl8EJHahEK1OSDO6Q2iAyqVkU3Hg4iEZZCS1AgkOpGNUZXk/YJ WCqEhi6NyNCHeplRuJr/BmY+xNohgAgcPAXlIbfavh28BjHhe/ZEjew/kQvUytr0tIf4 ivzqFbstCDp3FmrkGep1vaTcqovMXb65h+A2OgIqeQeMfC8mRDWkQYRAMtmgP+8pybKm pkP4+q8X9EmrtYta9QZWu5YWky3+72+Iz+A3AcwVt5owr/uMj+l9zqEwNtX+bg7jno5O gg1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=O+gSC6NwZyh8GlX0/8rGOK7WJ2Eoitq1cIB93Dk3fiI=; b=WRdx+kuM6I0qPEyipFkTBDqocJw7dxJUoz0DksTp+cVt7Ytpvfi3dC3334GJYCSh0x iSQd7PhL42Pzhccqvxe+mtF9wf31EJQBRukIKJupdesw0irds8dAtSkqcyO5R6TPi97n 9hcK6B6UxUUQQW40YXr3ZOkE1zzXJkVsWuzsB1MzjJBM5SWosvcZTuznNCnAFddichzY sAtyC6kmuEfna7bQxEiLTaHUYcHJbkKZk9YCbITJ31G71JUQqfmePS5AzrWXwtv14mCY AGZMBx5dPuZyvyjpsiPg6YnXLS18K3sz8BTJuC3bCCrxQro8BDmjb/vRoSaQbTd3cvEg UvGA== X-Gm-Message-State: AOAM533C3WvrjwTqncZpqq683fch85hdvZRx1tMRJRC90miKM8nHIGBB lktUyRCnPDCblKtWT9JB1oo= X-Google-Smtp-Source: ABdhPJzxzA3PSz9nd3PAoOKl6zTaPAC8eDBvwsJaCf+JAKnGA96Prxa+MCZN+ZjYThVc3T8uIDvtOw== X-Received: by 2002:a17:902:e5c7:b029:e5:df58:8155 with SMTP id u7-20020a170902e5c7b02900e5df588155mr7084649plf.55.1616031057186; Wed, 17 Mar 2021 18:30:57 -0700 (PDT) Received: from google.com ([2620:15c:211:201:8914:cdf:bafb:bf7b]) by smtp.gmail.com with ESMTPSA id w189sm286969pfw.86.2021.03.17.18.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 18:30:56 -0700 (PDT) Date: Wed, 17 Mar 2021 18:30:53 -0700 From: Minchan Kim To: Shakeel Butt Cc: Heiko Carstens , Andrew Morton , Roman Gushchin , Johannes Weiner , Hugh Dickins , Juergen Christ , Christian Borntraeger , Vasily Gorbik , Linux MM , Linux-Next Mailing List Subject: Re: [BUG -next] "memcg: charge before adding to swapcache on swapin" broken Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 85D74132 X-Stat-Signature: mh8xawnxnfqztqsxcmztdy9gc57idhbi Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf12; identity=mailfrom; envelope-from=""; helo=mail-pj1-f50.google.com; client-ip=209.85.216.50 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616031058-913252 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 Wed, Mar 17, 2021 at 05:23:04PM -0700, Shakeel Butt wrote: > CC: Minchan > > On Wed, Mar 17, 2021 at 2:39 PM Shakeel Butt wrote: > > > > On Wed, Mar 17, 2021 at 2:11 PM Heiko Carstens wrote: > > > > > > On Wed, Mar 17, 2021 at 09:44:21PM +0100, Heiko Carstens wrote: > > > > On Wed, Mar 17, 2021 at 08:44:14AM -0700, Shakeel Butt wrote: > > > > > > Config below. And the fun thing is that I cannot reproduce it today > > > > > > anymore with the elfutils test case - what _seems_ to be different is > > > > > > that the test suite runs much faster than yesterday evening. Usually > > > > > > an indication that there is no steal time (other guests which steal > > > > > > cpu time), which again _could_ indicate a race / lack of locking > > > > > > somewhere. > > > > > > This is kind of odd, since yesterday evening it was very reliable to > > > > > > trigger the bug :/ > > > > > > > > > > > > > > > > Thanks for the config. One question regarding swap, is it disk based > > > > > swap or zram? > > > > > > > > Swap device is a real disk. > > > > > > > > > By guests, do you mean there was another significant workload running > > > > > on the machine in parallel to the tests? > > > > > > > > That I don't know. I didn't check. I still can't reproduce with > > > > elfutils anymore, however... > > > > > > > > > If you don't mind can you try swapping01 as well. > > > > > > > > ltp's swapping01 test triggers immediately random processes being > > > > killed with SIGSEGV. I also tested with linux-next 20210316 and _only_ > > > > "memcg: charge before adding to swapcache on swapin" being reverted on > > > > top, and the problem is away - so it looks like the result of > > > > yesterday's bisect is indeed valid. > > > > > > I have to correct myself, actually the system has both: a real disk > > > _and_ zram as swap devices: > > > > > > # swapon -s > > > Filename Type Size Used Priority > > > /dev/dasdb1 partition 21635084 0 -2 > > > /dev/zram0 partition 1014780 0 100 > > > > > > When I disable /dev/zram with "swapoff /dev/zram0" the problem is away > > > as well, even with your patch applied. > > > > Thanks a lot. This was really helpful. I will try with zram on my setup. > > > > Can you also try with just one type of swap at the time for both? I > > really appreciate your help. > > Never mind I think I found the issue. Can you please add > set_page_private(page, entry.val) before swap_readpage(page, true) in > function do_swap_page() in mm/memory.c and try the swapping01 test > again? > > Michan, for SWP_SYNCHRONOUS_IO swap, do we ever reset page->private? > Normally for swapcache pages, it gets reset on delete from swap cache > but these types of swap skips swapcache, so, I think we never reset > page->private. Yub, you are correct. > > The simplest solution I can think of is to do set_page_private(page, > entry.val) before swap_readpage(page, true) and set_page_private(page, > 0) after. Since I did't read the bug in detail, I couldn't come up with how the missing reset is connected the problem while missing set_page_private with entry.val is clear. Anyway, your point is correct and I cannot think better way. Thanks.