Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp53883imm; Tue, 17 Jul 2018 20:37:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeE/YTAEuTOHg8XReh3QnJco8GhXGiV6BKSrCEGcT4tI0jny5bTg08woxYIjy275oL3d2lq X-Received: by 2002:a63:c608:: with SMTP id w8-v6mr4078658pgg.16.1531885060329; Tue, 17 Jul 2018 20:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531885060; cv=none; d=google.com; s=arc-20160816; b=AdURe+Ut7557VWv5HNlnG2GLDpphj73HVUtZDknSUZSZZ8J0oZEv29IYU4DKxsUDZV Vw9z0f33bVy1KXJRmnjrpeasNOtwHCgevA4iyE3226XS+pFToq/2HMZI/sdICNW0A54b M7aMdz29o/x3mkTe2GsCGu/5wRP2sJNaHuDicG8f0NuRF4PHctjKxE6jhcJGvtbomik/ MT8IMb2u7q5R142ShH+RF7Oz/jHIUvNX+M2eM0Eal8NRlptF9QCWcrPHZtDOBlQi/XTg A1jgHtx5U6x/TCbx2SGmi3wCq6Vj4F6ql7xFae+q7UXvvb7rnW0JGabkBNAAO4S3rk30 3Lxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Ju7cbAt9avMh692kQAz/QtD8SzT3nsmy7imi8f6rit0=; b=Y5GK+GBbKpa7ags0/wjHO83fskC3XKlIWEXEU1LGGyn8L6GITcWkFrOzWITBdkxPeY eSS2kx0F976hEoTgpBskRdNRxVc6eCWTIbf7CI+g73EeCABq+elhQyRz1SA+F97CSsnr gzbjKfxVnLZ5yqWH6tfnwXOgC8p8WdTDz78t2u7yFxdHjsCghR5HWM17ujjlVqycThGS IqL7zUZqn9xZ984QdBACxq3/ElnyFatoQhr0rCshLHit8eDtYMo/iVOAcQ7EL/H+nyT4 sqMoEkrmYpTrQgjGHPXA6GNPwCjE1dwUrGTX2puE+lTEhmnBRUBf+Hmdry+u6GFHzKcl pQoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=YyEOlLPW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si2321821plb.204.2018.07.17.20.37.21; Tue, 17 Jul 2018 20:37:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@osandov-com.20150623.gappssmtp.com header.s=20150623 header.b=YyEOlLPW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726166AbeGREMV (ORCPT + 99 others); Wed, 18 Jul 2018 00:12:21 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35363 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726092AbeGREMV (ORCPT ); Wed, 18 Jul 2018 00:12:21 -0400 Received: by mail-pg1-f195.google.com with SMTP id e6-v6so1348280pgv.2 for ; Tue, 17 Jul 2018 20:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Ju7cbAt9avMh692kQAz/QtD8SzT3nsmy7imi8f6rit0=; b=YyEOlLPWaNXHgBcNeRVgqcD/8/JICsjRn2fyzInvY4fC+GzpNwe2nD5YwbdPiEmr/n SvvmUmWo6b/oGOMfxA45jwbD66H0rhmJqDDJDaIfjBrIXGOb9kQ2ROpg0kTakNs/xlbx pIOQmaDdv5zk2wkUkn1PIow9YUVT9Rd553sEdQZhXirbu6+daPUoz2QBnBHNiMPVNn0V CwYXpUWwpnrmYab2r5Z018uJfC0Cni9lOyWFoOeGjPUVPmyCDgrUscPM0/1EwkTWwAco YebREKNI9/siAp8aej4Lr8edS+Hr/KKlm9060Mw0C8pL5qacwNro71YXiAy5L4LT5Gps yWhg== 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:user-agent; bh=Ju7cbAt9avMh692kQAz/QtD8SzT3nsmy7imi8f6rit0=; b=t5MHIcu7wEqhxoIEbs/A/4eabh+QVOH//ieT+LTRq9+fbg24i+A3ifZz8Vhpg41Krj MtHgPK4GmLoO52JwmfizbvxdxqV8K41EevWbKL+MyvDG33LUprDG/sfm8viZu7hfilu0 U874Yo9zkvdc1d+2z0Y2CAgHr4lPlCF1l2MsYr+DXS97Y/U/4ks1XsPGivkBXcBvYQ3A eIsNmkG9deBaw/BIRgIe2w8strTXsxbYhMLTegHJ7fA1ec4d2+GW00mkgY314ix6QkCS OG7CEs/IAvbeMckE0L4TrXhU1I9ZJOUUKIJD6phhYJcTgp98eOfjdyPa6ssCkkWYOIhD sXJg== X-Gm-Message-State: AOUpUlHOk5I7L+2Rdw/rRafkSCJsT1fCVFwOYmSMkA1KNZAZd5zKDxgs zJwOHF6bxErFCN5mjlt6IT9stw== X-Received: by 2002:a62:e106:: with SMTP id q6-v6mr3456088pfh.75.1531884996364; Tue, 17 Jul 2018 20:36:36 -0700 (PDT) Received: from vader ([2620:10d:c090:180::1:bc4f]) by smtp.gmail.com with ESMTPSA id y85-v6sm5133387pfa.170.2018.07.17.20.36.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Jul 2018 20:36:35 -0700 (PDT) Date: Tue, 17 Jul 2018 20:36:34 -0700 From: Omar Sandoval To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexey Dobriyan , Eric Biederman , James Morse , Bhupesh Sharma , kernel-team@fb.com Subject: Re: [PATCH v2 2/7] proc/kcore: replace kclist_lock rwlock with rwsem Message-ID: <20180718033634.GD29351@vader> References: <783ba3becc424db45e5d5c93559fc40ef6173f01.1531440458.git.osandov@fb.com> <20180717193841.271d1c57b6f88d75c83892be@linux-foundation.org> <20180718032405.GB29351@vader> <20180717202753.d49795afde465d04b56efbfb@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180717202753.d49795afde465d04b56efbfb@linux-foundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 17, 2018 at 08:27:53PM -0700, Andrew Morton wrote: > On Tue, 17 Jul 2018 20:24:05 -0700 Omar Sandoval wrote: > > > > > --- a/fs/proc/kcore.c > > > > +++ b/fs/proc/kcore.c > > > > @@ -59,8 +59,8 @@ struct memelfnote > > > > }; > > > > > > > > static LIST_HEAD(kclist_head); > > > > -static DEFINE_RWLOCK(kclist_lock); > > > > -static int kcore_need_update = 1; > > > > +static DECLARE_RWSEM(kclist_lock); > > > > +static atomic_t kcore_need_update = ATOMIC_INIT(1); > > > > > > It's unclear why kcore_need_update was changed to atomic_t - it's still > > > updated under kclist_lock? > > > > Not in the hotplug notifier (kcore_callback()) anymore, so I need the > > atomic_cmpxchg() in __kcore_update_ram(). > > Well that's just > > kcore_need_update = 1; > > and turning that into an atomic_set doesn't change anything(?). > > It's not a harmful change of course, but a bit ... odd. The change from read, ..., write to cmpxchg in __kcore_update_ram() is the important part, not the change from = to atomic_set(). I needed to change that because now kcore_need_update could potentially be set again by the hotplug notifier while we're in __kcore_update_ram(). But I'll just put all of this in the commit message in v3 :) > > That could use a mention in the commit message. > > That never hurts ;)