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=-4.0 required=3.0 tests=INCLUDES_PATCH, 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 62FBEC433DF for ; Thu, 11 Jun 2020 09:35:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1ED15204EC for ; Thu, 11 Jun 2020 09:35:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1ED15204EC 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 9EED68D008D; Thu, 11 Jun 2020 05:35:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99FA08D0084; Thu, 11 Jun 2020 05:35:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B4AB8D008D; Thu, 11 Jun 2020 05:35:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0187.hostedemail.com [216.40.44.187]) by kanga.kvack.org (Postfix) with ESMTP id 71CF58D0084 for ; Thu, 11 Jun 2020 05:35:28 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1F95310FA8 for ; Thu, 11 Jun 2020 09:35:28 +0000 (UTC) X-FDA: 76916423136.12.oven84_28149e726dd2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id E0C8518019972 for ; Thu, 11 Jun 2020 09:35:27 +0000 (UTC) X-HE-Tag: oven84_28149e726dd2 X-Filterd-Recvd-Size: 3702 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Thu, 11 Jun 2020 09:35:27 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id h5so5415302wrc.7 for ; Thu, 11 Jun 2020 02:35:27 -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=fCziW7D9RQqCEqfz7/IGRWHPMeEiWE2daJvcDBf0ZPA=; b=uByLTvCW9SFXIuziD2fY97H7dP3s1HY4iUfZhxq0xx7tLLIdBoZi2IYlIrRWgnqK8y nqMhLXvDlgO6ph5WgcY7dH0RLT3GbS9RayLOOB7rvZwDcZ4Vlr6yg1SLKBtDPJNZ2EcU 9qeC0NbgcuEqJcw9qi7ToEuNglenkfBxbq4cSj4Ly2+xkSoIVpAF6WvKUELrVdvQnox8 Eq66xP+OH2LodehAQjMW/ZC25j8rVcUVBksX75dlR8nR2YudyIOT7wr9ZvhutHgu/mL6 iW4qsTWCZSbU0kmV1KAAynaDnYabDC1PUmkCEomyD96Gyn0qF7oHL+FNbiTWow/3/II7 w7Qw== X-Gm-Message-State: AOAM532MXlzdE+ZJnKKBE6iqgA3Y9sfNXdxg6xPd0qTo6jA+yALKdjF7 eA64Q3OzpJTRHPF+H4mWfjc= X-Google-Smtp-Source: ABdhPJwH0mDt5sHqy/XukKQyC767OzXT3IpOZMbx+o8zAQCUAY/T6Fsnyv8bfwIUq0D76RR8+m6TOg== X-Received: by 2002:a5d:484b:: with SMTP id n11mr8689943wrs.356.1591868126445; Thu, 11 Jun 2020 02:35:26 -0700 (PDT) Received: from localhost (ip-37-188-174-201.eurotel.cz. [37.188.174.201]) by smtp.gmail.com with ESMTPSA id y19sm3165036wmi.6.2020.06.11.02.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2020 02:35:25 -0700 (PDT) Date: Thu, 11 Jun 2020 11:35:23 +0200 From: Michal Hocko To: Johannes Weiner Cc: Andrew Morton , 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: Re: [PATCH 16/19] mm: memcontrol: charge swapin pages on instantiation Message-ID: <20200611093523.GB20450@dhcp22.suse.cz> References: <20200508183105.225460-1-hannes@cmpxchg.org> <20200508183105.225460-17-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200508183105.225460-17-hannes@cmpxchg.org> X-Rspamd-Queue-Id: E0C8518019972 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 Fri 08-05-20 14:31:03, Johannes Weiner wrote: [...] > diff --git a/mm/memory.c b/mm/memory.c > index 832ee914cbcf..93900b121b6e 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3125,9 +3125,20 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) > page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, > vmf->address); > if (page) { > + int err; > + > __SetPageLocked(page); > __SetPageSwapBacked(page); > set_page_private(page, entry.val); > + > + /* Tell memcg to use swap ownership records */ > + SetPageSwapCache(page); > + err = mem_cgroup_charge(page, vma->vm_mm, > + GFP_KERNEL, false); > + ClearPageSwapCache(page); > + if (err) > + goto out_page; err would be a return value from try_charge and that can be -ENOMEM. Now 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. I am not an expert on the swap code so I might have missed some subtle issues but the rest of the patch seems reasonable to me. -- Michal Hocko SUSE Labs