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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 7E1CAC433DB for ; Thu, 18 Mar 2021 00:23:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BF81A64F21 for ; Thu, 18 Mar 2021 00:23:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF81A64F21 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 13E606B0070; Wed, 17 Mar 2021 20:23:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EE2C6B0071; Wed, 17 Mar 2021 20:23:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E85E66B0072; Wed, 17 Mar 2021 20:23:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id CD82A6B0070 for ; Wed, 17 Mar 2021 20:23:21 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 780F6180301CC for ; Thu, 18 Mar 2021 00:23:21 +0000 (UTC) X-FDA: 77931095802.17.EC7A280 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by imf11.hostedemail.com (Postfix) with ESMTP id 00A522000243 for ; Thu, 18 Mar 2021 00:23:18 +0000 (UTC) Received: by mail-lf1-f43.google.com with SMTP id o10so1719487lfb.9 for ; Wed, 17 Mar 2021 17:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qdeLCRQNx93p7KXnnXp7pVWMHGb2Aan+xzQMuMpfLuc=; b=KtTFu3obYd+2Wuiod7MhzCP/71wWAPzmCO7htBRVUPCmp/FqNaKBg8SExZEmBV/GJW EAAHrNgJefOqwlcctKQoWP9RP+stvITagdOrNiMDYR/zoAHzfo/QLC2OUoI/vJmGrvQB KFa7i9UZsphY53DhdJNkPGQEWWUasOodFGmd4O0QRHmb6c45RuuFAOb76UMbOWXvNcLB pvgbl2KvglicattGFZbH+rRzk1xG1ZhAYfSNpl+Nl/LEqhkTZ0JZ09QPpp6FVYH5x5K6 ybJ0bipD8MkNaAhJUKXiNG5cXHDz0cFp9zRdFtwPZJtfK0JFELKsld+FhLD/ZD4sznUA OG/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qdeLCRQNx93p7KXnnXp7pVWMHGb2Aan+xzQMuMpfLuc=; b=S5Tk9K5RaURVZtgjtFrpAJ4VU8b0yxYqsBz0HbPn83+swmlNhozmvu3ZeJbQFUidTf S0prThSvRh8VfjS89Hrq8pwxQjSwfNtZglYI7kZTsQkj7VZb8iEbwtnv4O7FKg1pGJKk pq2Lo8BgwL9D/J9oa/7vcQoBCd/ew10HVZazMyA2s3qV7GwdNA4fQ+903Qa8wkWnpbEx 0Er87wcdPlFcqwX4PLxXpmDYIdMwJioncI933Ckj1a2VYMouHySGQXKidCRzixdDQaCI JH4t4d0a5cX+FRh9HtNaCHg17ZctsnwxJfq5EpfChKt4yhQORiIfeQjEEYxQJGBCcp2a umNg== X-Gm-Message-State: AOAM533L9iCCn2c5+sK+lHIvI7/NgaRjWExCblnWS/dhOlkqrS2T9gN1 r6adGRwelxQf8d/IXFILHYabGv+1w+YbKfb9E8x86Q== X-Google-Smtp-Source: ABdhPJz3/bDxbj0h3gPjjr2oxsV0RNgVgq1Du7S3XCjwLMWtmr5teSUTbDYXiQgl47snmj6f6vTwjFNcadodn18KXyo= X-Received: by 2002:a05:6512:6c6:: with SMTP id u6mr3555998lff.347.1616026997164; Wed, 17 Mar 2021 17:23:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shakeel Butt Date: Wed, 17 Mar 2021 17:23:04 -0700 Message-ID: Subject: Re: [BUG -next] "memcg: charge before adding to swapcache on swapin" broken To: Heiko Carstens , Minchan Kim Cc: Andrew Morton , Roman Gushchin , Johannes Weiner , Hugh Dickins , Juergen Christ , Christian Borntraeger , Vasily Gorbik , Linux MM , Linux-Next Mailing List Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 00A522000243 X-Stat-Signature: sgobk5a7hhg8j6tusxa5oocjtyec8ezr Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=mail-lf1-f43.google.com; client-ip=209.85.167.43 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616026998-99386 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: 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. 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.