From patchwork Wed Jun 17 08:49:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 11609465 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C031C912 for ; Wed, 17 Jun 2020 08:49:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 97DF621527 for ; Wed, 17 Jun 2020 08:49:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97DF621527 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 9DC926B0022; Wed, 17 Jun 2020 04:49:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 965166B0023; Wed, 17 Jun 2020 04:49:31 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 804D66B0024; Wed, 17 Jun 2020 04:49:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 64F946B0022 for ; Wed, 17 Jun 2020 04:49:31 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 081783560 for ; Wed, 17 Jun 2020 08:49:31 +0000 (UTC) X-FDA: 76938080142.20.waste72_040ee5c26e06 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id D8018180C07A3 for ; Wed, 17 Jun 2020 08:49:30 +0000 (UTC) X-Spam-Summary: 2,0,0,4cd382cf10a08756,d41d8cd98f00b204,mstsxfx@gmail.com,,RULES_HIT:41:355:379:800:960:973:988:989:1260:1277:1312:1313:1314:1345:1359:1437:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3352:3865:3867:3868:4250:4321:5007:6261:7576:8957:9545:10004:10400:10967:11026:11232:11473:11658:11914:12043:12262:12296:12297:12438:12517:12519:12555:12679:12740:12895:13069:13311:13357:13439:13895:14096:14097:14181:14394:14721:21080:21324:21444:21451:21627:21966:21990:30012:30054:30090:30091,0,RBL:209.85.218.67:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: waste72_040ee5c26e06 X-Filterd-Recvd-Size: 3995 Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 17 Jun 2020 08:49:30 +0000 (UTC) Received: by mail-ej1-f67.google.com with SMTP id k11so1421155ejr.9 for ; Wed, 17 Jun 2020 01:49:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nicun5v32ytOl5kIX9jbwdnRFPXaMshWANgztjN0gQE=; b=bKEnZf4LP6Cg9rDzoVCzkcquWPgli62ud5GfVo8lB5DvsW5II6u+YIQZQxucjCw9lU acA+FUOpx2bLEotXBcWGEsySzchWfLqpr1LCMVsMQszhpYW4JME6EunEFrVy/zXxRT/H aI6h1CQRTFeSyFJRwvWla+VkG8jixmtiaYh1d8Zl6MIjqc0wcZwNjbWP1xOPnNVIWW+x 1LYm3SHcKn5AJpLl+9Gla5nP61jiIdLo6oacjTrjcAqDmdT3CpfngkJILvL9X+7nAdVU 9z7JwaLEozX7XEs0Wvn6ws5KEMA9njREieKq5hoRl18SxIcPD6//qW1jD+iYMqxDfCcE NZ8A== X-Gm-Message-State: AOAM530Aq6Ekfii2re08eL84mPCNGySvbh/QnXNIqzMVTIHU5Q1pSwo8 xXTQWcqiDLSADPy3GQZJH74= X-Google-Smtp-Source: ABdhPJwLXbtfdC+OVNbOEj3EtrmJW3BBo2ccpq+fDPSsytr30ENIzevd8Z1hLY9Ogbx4/7A1JClSWA== X-Received: by 2002:a17:906:b845:: with SMTP id ga5mr6509647ejb.300.1592383769411; Wed, 17 Jun 2020 01:49:29 -0700 (PDT) Received: from localhost (ip-37-188-158-19.eurotel.cz. [37.188.158.19]) by smtp.gmail.com with ESMTPSA id a24sm12795625ejc.109.2020.06.17.01.49.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 01:49:28 -0700 (PDT) Date: Wed, 17 Jun 2020 10:49:27 +0200 From: Michal Hocko To: Andrew Morton , Johannes Weiner Cc: Alex Shi , Joonsoo Kim , Shakeel Butt , Hugh Dickins , "Kirill A. Shutemov" , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH for 5.8] mm: do_swap_page fix up the error code instantiation Message-ID: <20200617084927.GK9499@dhcp22.suse.cz> References: <20200508183105.225460-1-hannes@cmpxchg.org> <20200508183105.225460-17-hannes@cmpxchg.org> <20200611093523.GB20450@dhcp22.suse.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200611093523.GB20450@dhcp22.suse.cz> X-Rspamd-Queue-Id: D8018180C07A3 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: I hope I haven't missed anything but the patch should be the following. From acd488c22b4bb2ee42526be8ca67145d5127b014 Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Wed, 17 Jun 2020 10:40:47 +0200 Subject: [PATCH] mm: do_swap_page fix up the error code do_swap_page returns error codes from the VM_FAULT* space. try_charge might return -ENOMEM, though, and then do_swap_page simply returns 0 which means a success. We almost never return ENOMEM for GFP_KERNEL single page charge. Except for async OOM handling (oom_disabled v1). So this needs translation to VM_FAULT_OOM otherwise the the page fault path will not notify the userspace and wait for an action. Fixes: 4c6355b25e8b ("mm: memcontrol: charge swapin pages on instantiation") Signed-off-by: Michal Hocko Signed-off-by: Michal Hocko Acked-by: Johannes Weiner --- mm/memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index dc7f3543b1fd..d944b7946b27 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3140,8 +3140,10 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) err = mem_cgroup_charge(page, vma->vm_mm, GFP_KERNEL); ClearPageSwapCache(page); - if (err) + if (err) { + err = VM_FAULT_OOM; goto out_page; + } lru_cache_add(page); swap_readpage(page, true);