Re: [v3 5/6] mm, oom: don't mark all oom victims tasks with TIF_MEMDIE

2017-06-30 Thread Michal Hocko
On Thu 29-06-17 14:45:13, Roman Gushchin wrote:
> On Thu, Jun 29, 2017 at 10:53:57AM +0200, Michal Hocko wrote:
> > On Wed 21-06-17 22:19:15, Roman Gushchin wrote:
> > > We want to limit the number of tasks which are having an access
> > > to the memory reserves. To ensure the progress it's enough
> > > to have one such process at the time.
> > > 
> > > If we need to kill the whole cgroup, let's give an access to the
> > > memory reserves only to the first process in the list, which is
> > > (usually) the biggest process.
> > > This will give us good chances that all other processes will be able
> > > to quit without an access to the memory reserves.
> > 
> > I don't like this to be honest. Is there any reason to go the reduced
> > memory reserves access to oom victims I was suggesting earlier [1]?
> > 
> > [1] 
> > http://lkml.kernel.org/r/http://lkml.kernel.org/r/1472723464-22866-2-git-send-email-mho...@kernel.org
> 
> I've nothing against your approach. What's the state of this patchset?
> Do you plan to bring it upstream?

Just the specific patch I have linked should be sufficient for what you
need here. The patchset had some issues which I didn't have time to fix
and as such the need for the above patch was not a high priority as
well.
-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 0/3] USB Audio Gadget: Support multiple sampling rates

2017-06-30 Thread Julian Scheel
Sending v2 of this patch series, including fixes for build regressions
introduced with the original series. I missed the usage of f_uac* in the
legacy modules and did not test that. Fixed now, see patches changelog for
details.

This patch series adds support for exposing multiple supported sampling rates
from UAC1 and UAC2 USB gadgets to the connected host. It is currently limited
to up to ten discrete sampling frequencies. The USB specification does not
actually limit this, but to avoid complex list handling I am using a static
array for now.
As the configfs bindings for f_uac1 and f_uac2 have been identical already, I
decided to move the shared code for this out of the functions first. This
avoids code duplication and simplifies the addition of the list parsing for
sampling rates.
The host can configure active sampling rate and the function adapts it's
internal active rate automatically. On playback/capture start the rate is
checked, so that the user recognizes rate mismatches. Furthermore the active
rate is exposed as an amixer control with change notifications, so that
users can check current rate upfront and get notified about updates.

Julian Scheel (3):
  usb: gadget: f_uac1: Fix endpoint reading
  usb: gadget: f_uac*: Reduce code duplication
  usb: gadget: f_uac*: Support multiple sampling rates

 Documentation/ABI/testing/configfs-usb-gadget-uac1 |   4 +-
 Documentation/usb/gadget-testing.txt   |   8 +-
 drivers/usb/gadget/function/f_uac1.c   | 258 +-
 drivers/usb/gadget/function/f_uac2.c   | 297 ++---
 drivers/usb/gadget/function/u_audio.c  | 118 +++-
 drivers/usb/gadget/function/u_audio.h  |   9 +-
 drivers/usb/gadget/function/u_uac.h| 180 +
 drivers/usb/gadget/function/u_uac1.h   |  41 ---
 drivers/usb/gadget/function/u_uac2.h   |  44 ---
 drivers/usb/gadget/legacy/audio.c  |  91 ++-
 10 files changed, 608 insertions(+), 442 deletions(-)
 create mode 100644 drivers/usb/gadget/function/u_uac.h
 delete mode 100644 drivers/usb/gadget/function/u_uac1.h
 delete mode 100644 drivers/usb/gadget/function/u_uac2.h

-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 1/3] usb: gadget: f_uac1: Fix endpoint reading

2017-06-30 Thread Julian Scheel
The endpoint is stored in the lower byte of wIndex, according to USB
Audio 1.0 specification, section 5.2.1.1.

Signed-off-by: Julian Scheel 
---
 drivers/usb/gadget/function/f_uac1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_uac1.c 
b/drivers/usb/gadget/function/f_uac1.c
index 8656f84e17d9..b955913bd7ea 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -327,7 +327,7 @@ static int audio_set_endpoint_req(struct usb_function *f,
 {
struct usb_composite_dev *cdev = f->config->cdev;
int value = -EOPNOTSUPP;
-   u16 ep = le16_to_cpu(ctrl->wIndex);
+   u8  ep = le16_to_cpu(ctrl->wIndex) & 0xff;
u16 len = le16_to_cpu(ctrl->wLength);
u16 w_value = le16_to_cpu(ctrl->wValue);
 
@@ -363,7 +363,7 @@ static int audio_get_endpoint_req(struct usb_function *f,
 {
struct usb_composite_dev *cdev = f->config->cdev;
int value = -EOPNOTSUPP;
-   u8 ep = ((le16_to_cpu(ctrl->wIndex) >> 8) & 0xFF);
+   u8 ep = le16_to_cpu(ctrl->wIndex) & 0xff;
u16 len = le16_to_cpu(ctrl->wLength);
u16 w_value = le16_to_cpu(ctrl->wValue);
 
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 3/3] usb: gadget: f_uac*: Support multiple sampling rates

2017-06-30 Thread Julian Scheel
Implement support for multiple sampling rates in the USB Audio gadgets.
A list of sampling rates can be specified via configfs. All enabled
sampling rates are sent to the USB host on request. When the host
selects a sampling rate the internal active rate is updated. The
currently configured rates are exposed through amixer controls. Also on
pcm open from userspace the requested rated is checked against the
currently configured rate of the host.

Signed-off-by: Julian Scheel 
---
 Documentation/ABI/testing/configfs-usb-gadget-uac1 |   4 +-
 Documentation/usb/gadget-testing.txt   |   8 +-
 drivers/usb/gadget/function/f_uac1.c   | 120 +
 drivers/usb/gadget/function/f_uac2.c   | 146 +++--
 drivers/usb/gadget/function/u_audio.c  | 119 -
 drivers/usb/gadget/function/u_audio.h  |   9 +-
 drivers/usb/gadget/function/u_uac.h|  68 +-
 7 files changed, 396 insertions(+), 78 deletions(-)

diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uac1 
b/Documentation/ABI/testing/configfs-usb-gadget-uac1
index abfe447c848f..ad2fa4a00918 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget-uac1
+++ b/Documentation/ABI/testing/configfs-usb-gadget-uac1
@@ -5,10 +5,10 @@ Description:
The attributes:
 
c_chmask - capture channel mask
-   c_srate - capture sampling rate
+   c_srate - list of capture sampling rates (comma-separataed)
c_ssize - capture sample size (bytes)
p_chmask - playback channel mask
-   p_srate - playback sampling rate
+   p_srate - list of playback sampling rates (comma-separated)
p_ssize - playback sample size (bytes)
req_number - the number of pre-allocated request
for both capture and playback
diff --git a/Documentation/usb/gadget-testing.txt 
b/Documentation/usb/gadget-testing.txt
index fbc397d17e98..85878880 100644
--- a/Documentation/usb/gadget-testing.txt
+++ b/Documentation/usb/gadget-testing.txt
@@ -629,10 +629,10 @@ The function name to use when creating the function 
directory is "uac2".
 The uac2 function provides these attributes in its function directory:
 
c_chmask - capture channel mask
-   c_srate - capture sampling rate
+   c_srate - list of capture sampling rates (comma-separated)
c_ssize - capture sample size (bytes)
p_chmask - playback channel mask
-   p_srate - playback sampling rate
+   p_srate - list of playback sampling rates (comma-separated)
p_ssize - playback sample size (bytes)
req_number - the number of pre-allocated request for both capture
 and playback
@@ -790,10 +790,10 @@ The function name to use when creating the function 
directory is "uac1".
 The uac1 function provides these attributes in its function directory:
 
c_chmask - capture channel mask
-   c_srate - capture sampling rate
+   c_srate - list of capture sampling rates (comma-separated)
c_ssize - capture sample size (bytes)
p_chmask - playback channel mask
-   p_srate - playback sampling rate
+   p_srate - list of playback sampling rates (comma-separated)
p_ssize - playback sample size (bytes)
req_number - the number of pre-allocated request for both capture
 and playback
diff --git a/drivers/usb/gadget/function/f_uac1.c 
b/drivers/usb/gadget/function/f_uac1.c
index 6e86e4f704e1..d14777973b9f 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -2,6 +2,7 @@
  * f_uac1.c -- USB Audio Class 1.0 Function (using u_audio API)
  *
  * Copyright (C) 2016 Ruslan Bilovol 
+ * Copyright (C) 2017 Julian Scheel 
  *
  * This driver doesn't expect any real Audio codec to be present
  * on the device - the audio streams are simply sinked to and
@@ -175,16 +176,18 @@ static struct uac1_as_header_descriptor as_in_header_desc 
= {
.wFormatTag =   UAC_FORMAT_TYPE_I_PCM,
 };
 
-DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(1);
+DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(UAC_MAX_RATES);
+#define uac_format_type_i_discrete_descriptor \
+   uac_format_type_i_discrete_descriptor_##UAC_MAX_RATES
 
-static struct uac_format_type_i_discrete_descriptor_1 as_out_type_i_desc = {
-   .bLength =  UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(1),
+static struct uac_format_type_i_discrete_descriptor as_out_type_i_desc = {
+   .bLength =  0, /* filled on rate setup */
.bDescriptorType =  USB_DT_CS_INTERFACE,
.bDescriptorSubtype =   UAC_FORMAT_TYPE,
.bFormatType =  UAC_FORMAT_TYPE_I,
.bSubframeSize =2,
.bBitResolution =   16,
-   .bSamFreqType = 1,
+   .bSamFreqType = 0, /* filled on rate setup */
 };
 
 /* Standard ISO OUT Endpo

[PATCHv2 2/3] usb: gadget: f_uac*: Reduce code duplication

2017-06-30 Thread Julian Scheel
This replaces the dedicated headers for uac1 and uac2 functions with a
shared header for both of them. Apart from unifying the struct names,
further duplicated code for configfs setup is moved out of the function
files into the shared header.

Signed-off-by: Julian Scheel 
---
Changes in v2:
- Fix build as module
- Fix build of legacy/audio module in f_uac1/f_uac2 mode

 drivers/usb/gadget/function/f_uac1.c  | 142 --
 drivers/usb/gadget/function/f_uac2.c  | 161 ++
 drivers/usb/gadget/function/u_audio.c |   1 -
 drivers/usb/gadget/function/u_uac.h   | 116 
 drivers/usb/gadget/function/u_uac1.h  |  41 -
 drivers/usb/gadget/function/u_uac2.h  |  44 --
 drivers/usb/gadget/legacy/audio.c |  91 +--
 7 files changed, 222 insertions(+), 374 deletions(-)
 create mode 100644 drivers/usb/gadget/function/u_uac.h
 delete mode 100644 drivers/usb/gadget/function/u_uac1.h
 delete mode 100644 drivers/usb/gadget/function/u_uac2.h

diff --git a/drivers/usb/gadget/function/f_uac1.c 
b/drivers/usb/gadget/function/f_uac1.c
index b955913bd7ea..6e86e4f704e1 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -21,18 +21,7 @@
 #include 
 
 #include "u_audio.h"
-#include "u_uac1.h"
-
-struct f_uac1 {
-   struct g_audio g_audio;
-   u8 ac_intf, as_in_intf, as_out_intf;
-   u8 ac_alt, as_in_alt, as_out_alt;   /* needed for get_alt() */
-};
-
-static inline struct f_uac1 *func_to_uac1(struct usb_function *f)
-{
-   return container_of(f, struct f_uac1, g_audio.func);
-}
+#include "u_uac.h"
 
 /*
  * DESCRIPTORS ... most are static, but strings and full
@@ -435,7 +424,7 @@ static int f_audio_set_alt(struct usb_function *f, unsigned 
intf, unsigned alt)
struct usb_composite_dev *cdev = f->config->cdev;
struct usb_gadget *gadget = cdev->gadget;
struct device *dev = &gadget->dev;
-   struct f_uac1 *uac1 = func_to_uac1(f);
+   struct f_uac *uac1 = func_to_uac(f);
int ret = 0;
 
/* No i/f has more than 2 alt settings */
@@ -480,7 +469,7 @@ static int f_audio_get_alt(struct usb_function *f, unsigned 
intf)
struct usb_composite_dev *cdev = f->config->cdev;
struct usb_gadget *gadget = cdev->gadget;
struct device *dev = &gadget->dev;
-   struct f_uac1 *uac1 = func_to_uac1(f);
+   struct f_uac *uac1 = func_to_uac(f);
 
if (intf == uac1->ac_intf)
return uac1->ac_alt;
@@ -498,7 +487,7 @@ static int f_audio_get_alt(struct usb_function *f, unsigned 
intf)
 
 static void f_audio_disable(struct usb_function *f)
 {
-   struct f_uac1 *uac1 = func_to_uac1(f);
+   struct f_uac *uac1 = func_to_uac(f);
 
uac1->as_out_alt = 0;
uac1->as_in_alt = 0;
@@ -513,16 +502,16 @@ static int f_audio_bind(struct usb_configuration *c, 
struct usb_function *f)
 {
struct usb_composite_dev*cdev = c->cdev;
struct usb_gadget   *gadget = cdev->gadget;
-   struct f_uac1   *uac1 = func_to_uac1(f);
+   struct f_uac*uac1 = func_to_uac(f);
struct g_audio  *audio = func_to_g_audio(f);
-   struct f_uac1_opts  *audio_opts;
+   struct f_uac_opts   *audio_opts;
struct usb_ep   *ep = NULL;
struct usb_string   *us;
u8  *sam_freq;
int rate;
int status;
 
-   audio_opts = container_of(f->fi, struct f_uac1_opts, func_inst);
+   audio_opts = container_of(f->fi, struct f_uac_opts, func_inst);
 
us = usb_gstrings_attach(cdev, uac1_strings, ARRAY_SIZE(strings_uac1));
if (IS_ERR(us))
@@ -630,82 +619,27 @@ static int f_audio_bind(struct usb_configuration *c, 
struct usb_function *f)
 
 /*-*/
 
-static inline struct f_uac1_opts *to_f_uac1_opts(struct config_item *item)
-{
-   return container_of(to_config_group(item), struct f_uac1_opts,
-   func_inst.group);
-}
-
-static void f_uac1_attr_release(struct config_item *item)
-{
-   struct f_uac1_opts *opts = to_f_uac1_opts(item);
-
-   usb_put_function_instance(&opts->func_inst);
-}
-
 static struct configfs_item_operations f_uac1_item_ops = {
-   .release= f_uac1_attr_release,
+   .release= f_uac_attr_release,
 };
 
-#define UAC1_ATTRIBUTE(name)   \
-static ssize_t f_uac1_opts_##name##_show(  \
- struct config_item *item, \
- char *page)   \
-{  \
-   struct f_uac1_opts *opts

[PATCH v2] Documentation: fix wrong example command

2017-06-30 Thread Matteo Croce
In the IPVLAN documentation there is an example command line where the
master and slave interface names are inverted.
Fix the command line and also add the optional `name' keyword to better
describe what the command is doing.

v2: added commit message

Signed-off-by: Matteo Croce 
---
 Documentation/networking/ipvlan.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/networking/ipvlan.txt 
b/Documentation/networking/ipvlan.txt
index 24196ce..1fe42a8 100644
--- a/Documentation/networking/ipvlan.txt
+++ b/Documentation/networking/ipvlan.txt
@@ -22,9 +22,9 @@ The driver can be built into the kernel (CONFIG_IPVLAN=y) or 
as a module
There are no module parameters for this driver and it can be configured
 using IProute2/ip utility.
 
-   ip link add link   type ipvlan mode { l2 | l3 | 
l3s }
+   ip link add link  name  type ipvlan mode { l2 | 
l3 | l3s }
 
-   e.g. ip link add link ipvl0 eth0 type ipvlan mode l2
+   e.g. ip link add link eth0 name ipvl0 type ipvlan mode l2
 
 
 4. Operating modes:
-- 
2.9.4

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 0/5] DAX common 4k zero page

2017-06-30 Thread Ross Zwisler
On Wed, Jun 28, 2017 at 04:01:47PM -0600, Ross Zwisler wrote:
> When servicing mmap() reads from file holes the current DAX code allocates
> a page cache page of all zeroes and places the struct page pointer in the
> mapping->page_tree radix tree.  This has three major drawbacks:
> 
> 1) It consumes memory unnecessarily.  For every 4k page that is read via a
> DAX mmap() over a hole, we allocate a new page cache page.  This means that
> if you read 1GiB worth of pages, you end up using 1GiB of zeroed memory.
> 
> 2) It is slower than using a common zero page because each page fault has
> more work to do.  Instead of just inserting a common zero page we have to
> allocate a page cache page, zero it, and then insert it.
> 
> 3) The fact that we had to check for both DAX exceptional entries and for
> page cache pages in the radix tree made the DAX code more complex.
> 
> This series solves these issues by following the lead of the DAX PMD code
> and using a common 4k zero page instead.  This reduces memory usage and
> decreases latencies for some workloads, and it simplifies the DAX code,
> removing over 100 lines in total.
> 
> Andrew, I'm still hoping to get this merged for v4.13 if possible. I I have
> addressed all of Jan's feedback, but he is on vacation for the next few
> weeks so he may not be able to give me Reviewed-by tags.  I think this
> series is relatively low risk with clear benefits, and I think we should be
> able to address any issues that come up during the v4.13 RC series.
> 
> This series has passed my targeted testing and a full xfstests run on both
> XFS and ext4.

This series has also passed the automated 0-day kernel builds in 168 configs.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scripts/kernel-doc: handle DECLARE_HASHTABLE

2017-06-30 Thread Jakub Kicinski
DECLARE_HASHTABLE needs similar handling to DECLARE_BITMAP
because otherwise kernel-doc assumes the member name is the
second, not first macro parameter.

Signed-off-by: Jakub Kicinski 
---
 scripts/kernel-doc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a26a5f2dce39..c1ffd31ff423 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -2189,6 +2189,8 @@ sub dump_struct($$) {
$members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos;
# replace DECLARE_BITMAP
$members =~ s/DECLARE_BITMAP\s*\(([^,)]+), ([^,)]+)\)/unsigned long 
$1\[BITS_TO_LONGS($2)\]/gos;
+   # replace DECLARE_HASHTABLE
+   $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+), ([^,)]+)\)/unsigned long 
$1\[1 << (($2) - 1)\]/gos;
 
create_parameterlist($members, ';', $file);
check_sections($file, $declaration_name, "struct", $sectcheck, 
$struct_actual, $nested);
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html