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=-7.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 3E2D0C433DF 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 0C7E920C09 for ; Wed, 17 Jun 2020 08:49:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C7E920C09 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) Received: by kanga.kvack.org (Postfix, from userid 40) id 965166B0023; Wed, 17 Jun 2020 04:49:31 -0400 (EDT) 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-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-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-Type: text/plain; charset=us-ascii 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 --- 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); -- 2.26.2 -- Michal Hocko SUSE Labs